You have confessed the sin, and you’re being repentant, so yes, you are forgiven. I can tell from your question you’re a young man. As a much older man, I want to give you some advice. I pray that God puts wisdom in my words to you.
Sexual sins are probably the hardest sins we have to fight against. Even at 61 I still have to fight this. It’s truly a life long battle. And even if you’re blessed with a wife someday, there is still a temptation to commit sexual sins. You just have to keep saying no to it. But if you do slip and fall, do not despair over it. (that would be the devil. If you start to despair over it) Just get up, confess the sin to God, and Our God is faithful to forgive us when we really mean it.
Chances are you will slip up again, because this is 1 of the toughest battles we fight. When and if that happens, that’s when Satan comes along and tries to tell you all kinds of lies. This is the real danger. He will tell you things like, God didn’t forgive you, you’re doomed now and going to hell. That’s a lie. He’ll also try telling you that you don’t even know God. Who are you trying to fool. You yourself know that you don’t know God. Lies, lies and more lies. If he can’t trick you with those, his next 1 is often, there is no God, so what are you worried about. Masturbate to your heart’s content. Another is, if you don’t use it, you’ll lose it. If you ever get a wife you won’t be able to get an erection because you haven’t been exercising it. More lies, my young friend.
Let me teach you something about male physiology. You probably heard that the penis is muscle tissue. This is true. But you may not know it’s a unique muscle unlike any others. For a typical muscle it gets hard when you contract it. This is why the more you exercise your other muscles, arms, legs, stomach etc., the harder they become. Yes, but not the penile muscle. It works like this. When the muscle tissue is contracted your penis is soft and flaccid. When the muscle tissue relaxes, blood flows into your penis, and that’s what makes it get hard, being full of blood. We still aren’t exactly sure of all the physiological mechanisms at work when we get erect. But you don’t need to work it out, to keep it in good shape. So don’t let Satan trick you with that lie.
I think for me I’m reaching the end of my sojourn on Earth, and I won’t have to fight the devil too much longer. But I ask that God bless you and keep you strong in your battle against sin.