How can a young person stay on the path of purity?

By living according to your word. 

Psalm 119 v 9