If you confess your sins he is faithful and forgives you as First John says. So you can have peace of mind that you won't be doing time in purgatory as long as you confess your sin, and you confess that you are weak to overcome this sin by your own strength. God knows that you sin (touch) because of your weakness and he will forgive you.
Now, if you get sanctified God will empower your will to conquer the sin. You can only get sanctified by faith as scripture says and John Wesley and the Holiness Churches teach. You can't overcome the sin of masturbation by yourself, only by accepting God's free grace. Romans chapter 8 says that we've been given the spirit of adoption, not the spirit of bondage, believe that, trust that Jesus has given you that spirit, accept the free gift, and pray with faith (confidence and trust) that you are receiving the spirit of adoption, that you are dead to to the flesh and dead to sin and alive in Christ's resurrection. Only by accepting this free gift from God can you be sanctified, and you do it by faith, you don't wait until you stop masturbating, you just trust God. The more you try to fight the sin by yourself the more you will fail, God will teach you that the works of man can't please him, he'll teach you how incapable you are of overcoming the sin by your own efforts, he'll show you that you can only overcome the sin by faith.
Now before you can get sanctified you need to be justified. You have to be sure that you are going to heaven. You may not be justified right now because you are saying you'll have to go Purgatory. That is an invention of the catholic church, purgatory is not biblical. So, you have to get right with God first, you need to have assurance of salvation, a justifying faith before you can receive the sanctifying faith. You need to trust Christ that he died for your sins, that his death is sufficient, that you are going to heaven because of Christ's righteousness. Until you trust Christ for your salvation instead of your own efforts you can't get saved (justified) and God won't sanctify. Maybe you are already justified, then all you have to do is accept by faith now the gift of sanctification. Justification makes you right before God and gets you to heaven on Christ's merit alone without any works, sanctification gives you dominion over sin on earth.
I am both justified and sanctified and I have experienced both works of grace. There's both a justifying faith and a sanctifying faith. I talk to you based on my personal experience, and what I teach is pretty similar to what Wesley taught. Maybe the only difference is that Wesley taught purity of heart after sanctification, I would go further and add that purity of heart means freedom of the will, power to overcome sin. The unsanctified christian has some sins that he/she is aware of, but can't overcome because of the weakness of the flesh. But don't sweat it because we were all unsanctified at one time (plus it is justification and not sanctification that gets you to heaven), even the apostle Paul was unsanctified when he speaks in Romans 7 and says "oh wretched man that I am" or in Second Corinthians when he talks about the thorn in the flesh from Satan that God refused to remove to humble the apostle. I'm sure God removed that thorn in the flesh later on and Paul was sanctified. God works in strange ways, he will not take Satan away sometimes, he will let Satan harass you although never reign in you, and then God moves in and binds Satan up and sanctifies you. Not every Christian is sanctified on earth, some are sanctified either close to death (like Wesley said) or right after death (as Luther said), but I do believe that sanctification by faith should be preached to everybody because some Christians have experienced it. Wesley said, it's a free gift from God for everybody to take, go grab it, don't wait for death, it's available right now. I have experienced it and that's why I preach it, because it makes you free from sin's dominion on earth. But this gift is only available to those that are saved (justified), if you are not saved, if you don't trust that Christ died for your sins, that his death and resurriection alone gets you to heaven as long as you try your best (and even if your will is weak), then you have a problem. You will have to get saved first before you even think about being sanctified. At least that's the way God worked with me, maybe he works in a different way with others but I know only the way the Lord showed me.
Now one thing though is that when you trust Christ for the forgiveness of your sins (justification) you will have to trust him at the same time that he has empowered you to overcome sin. You will receive an assurance from God at that time, the holy spirit will witness to you, you will receive the assurance of salvation. Now, you will realize after a few weeks or months afterwards realize that maybe you don't have total dominion over sin although your will have been strengthened after trusting Christ. You should still have that assurance that you go to heaven because of Christ's work. It is at that time when you can accept God's second gift of sanctification. It works like this with most saints, although it is possible to be both justified and sanctified in the first work of grace it rarely happens as studies among believers conducted by John Wesley proved. Still it is at justification when you are initially annointed with power from above, you are baptized with the holy spirit, you receive the assurance of salvation, the testimony of the spirit that lives in you. Prior to justification you are just baptized into repentance with water.