"Whosoever transgresseth, and abideth not in the doctrine of Christ, hath not God. He that abideth in the doctrine of Christ, he hath both the Father and the Son." (2 John 9)
Notice that we can still abide in Christ, even when we sin.
"Whoever transgresses and does not abide. . ."
Read these verses to let this wonderful truth of our perfect righteousness in Christ, apart from our works, and even when we sin:
"Blessed is the man unto whom the LORD imputeth not iniquity, and in whose spirit there is no guile." (Psalm 32: 2)
Notice that the Lord would not be imputing any sin in the first place, if the person had not sinned in the first place!
Consider also these verses:
"And you, being dead in your sins and the uncircumcision of your flesh, hath he quickened together with him, having forgiven you all trespasses;" (Colossians 2: 13)
Having forgiven you ALL trespasses: not some, and not just the ones that you are aware of!
"But if we walk in the light, as he is in the light, we have fellowship one with another, and the blood of Jesus Christ his Son cleanseth us from all sin." (1 John 1: 7)
Such is the magnificent grace of God, that He blesses in spite of ourselves, not because of ourselves, or anything which we have done or said, or even thought or felt!
"No weapon that is formed against thee shall prosper; and every tongue that shall rise against thee in judgment thou shalt condemn. This is the heritage of the servants of the LORD, and their righteousness is of me, saith the LORD." (Isaiah 54: 17)
We are established in His, not our, righteousness.
"Lead me, O LORD, in thy righteousness because of mine enemies; make thy way straight before my face." (Psalm 5: 8)
He leads us in His righteousness, as well.
"For if by one man's offence death reigned by one; much more they which receive abundance of grace and of the gift of righteousness shall reign in life by one, Jesus Christ." (Romans 5: 17)
And His righteousness we receive and continue receiving as a gift, not something that we earn.
We abide in Christ, we identify with Christ, and anyone who claims otherwise, or who believes that when you sin, you lose your place in Christ, have nothing to do with such people!
One more thing: Doctrine is all about the Person of Jesus. Everything in the Bible is about Himself. Not you or me, and not precepts on how to live. But about Life, and Him in greater abundance!