Thank you for your question. In short, you have to keep trying until the sexual desire starts to subside. When you have committed sins relating to sexual desires the desire becomes more intense and so trying to prevent it takes a lot of willpower. At times, in the beginning, the desire overcomes the willpower even if you know what you are doing is wrong which results in a lot of guilt. That guilt needs to be used to increase your willpower until you can finally break the cycle and then over time the desire will become subdued and controllable. It is also important to seek halal means to fulfil sexual desires so that you have an outlet as sexual desires without an outlet become all the more intense.
Just keep going and don't give up. In the end with a lot of effort, you will succeed and after a time those sins will be a thing of the past.
May you always be successful