John in his first letter clearly says that sin is always with us, and the person who denies that they have sin deceives himself and the truth is not in him. We have people who have said that they have totally overcome sin in their lives and no longer sin. They are deceived, because in this life we will never overcome sin. It remains there as an albatross around our necks. We know that the guilt and punishment for sin has been removed from us through the finished work of Christ on the Cross, but we still need further forgiveness for the sins we go on committing in spite of our best efforts to avoid them. This is why John wrote, "If we sin, we have an advocate with the Father, Jesus Christ." He also said that if we do sin and confess it, God is faithful and just to forgive our sin and cleanse us from all unrighteousness. There is a two-fold function here. (1) forgiveness; and (2) ongoing cleansing and development in righteous living.
We will always have a battle between the flesh and the Spirit until the day we die. When we do have our failures, which are our sins, we can come boldly to the throne of grace to find mercy. Running to Christ when we have failed ensures forgiveness and restoration of fellowship with God, and that's what we do when we come boldly to the throne of grace. When we do come to the throne of grace, we will not be turned away, because the Scripture says, "He to comes to Me, I will in no wise cast out."
So we need not be afraid of our failures, because we have Christ as our defence lawyer in heaven. But at the same time, knowing these things is not an excuse to choose to sin, but we all know that temptation from the flesh can be very strong and overpowering at times because of our weakness, but when we are weak, then He is strong in us, and when we do fail as we will surely do many times, we can depend on 1 John 1:9 to keep us in fellowship with God.