You need to first not Watch any TV, films, books, magazines, or go to places, or listen to music, go to Internet sites, that has any impure references.
(which is acceptable on modern TV these days)
Next, you need to pray 30mins each day. Or 10mins minimum.
And read a catholic book / Bible a little each day.
Wear a blessed miraculous medal and brown scapular.
Go to confession monthly mimimum.
Think positive thoughts and live a balanced life of fulfilment with your dreams, hobbies, talents, rest, sociality, studies, fun, etc… and always think positive. Negative thoughts lead to seeking joy in something that may be sinful.
Think about and figure out over time, what are your triggers, is it certain friends who have a bad influence on your catholic thoughts, is it lack of hope financially, is it difficult time with siblings or work colleagues, loneliness,
Sin is an addiction. Jesus said anyone who sins is a slave to sin. An alcoholic or drug addict or gambler, all have triggers and a psychological reason for seeking some escape in something that is not Holy.
Satan is a liar,
Jesus said, resist the devil and he will flee from you.
Keep saying, “No satan, in the Name of Jesus.”
Pray 3 Hail Marys for purity each day. And the St Michael prayer. Have a holy water bottle in your room and bless your room each night. St Theresa of Avila said that evil spirits immediately leave and never return to spots where Holy water is used, or used regularly.
Tell Jesus, “No I will not sin Lord. I will wait for marriage.”