Ps. 119:9 How can a young person stay pure? By obeying your word and following its rules.
How can anyone stay pure? Note first of all that the question is not, "How can a young person become pure?" nor is it, "Can a young person even be pure?". We are made pure before God the moment we accept Jesus as our Savior. Jesus forgives all of our sins and makes us pure before God. In Christ the old nature that causes us to sin is changed into the new nature that causes us to want to not sin. We desire to please God and live under His guidance and influence.
We stay pure by obeying God's Word and following its rules. Our unwillingness to do it hinders our growth and discolors our souls. Every time we disobey God we put a chink in our armor of purity. Disobedience darkens our soul. It impacts our relationship with God. It pulls us away from God and the farther we get from God, the less pure we become. In fact, if we are not trying to live by God's Word, we do not have pure hearts before God; we are not His children.
In order for us to remain pure we must obey God's Word. We must purposely strive to know God's Word and obey it. We can't put into practice what we don't know. So, we must constantly stay connected with the Word. We must read it, meditate upon it, and ask the Lord to help us live it out. We won't be able to perfectly do it, but we will be able to do it more than we won't. Our ability to live in obedience is directly connected to the effort and time we put into studying the Word. There is no sugarcoating it. In order to stay pure before God, we must invest our lives in His Word. We must strive daily to put into practice what we know and seek to learn more.
Blessed are the pure in heart, for they shall see God, both now and in eternity.