This question already has an answer here:

How should we repent for masturbation, formerly being homosexual, bisexual, or crossdresser? Is praying 2 rakats and not committing the same sin is enough, or should we do more to fully repent?

marked as duplicate by UmH, Jamila, Sassir, Harun, user29772 Jul 23 at 9:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.