Hey Nick,
Nothing wrong with Masturbating and you perceiving you are losing your erection at your age, is all in your head. There is nothing wrong with you, your just letting your brain overtake, very common happens to a lot of guys, it will pass.
Hi stop watching porn then you won't want to masturbate , your testicle pain maybe you been rough on yourself , take care ,