What do you do?? Well, first step is to seek help from a medical doctor.
YOur penis could be hurting for many reasons unknone to us.
YOu could have an std,
you could have a kidney infection, or kidney stone,
you could have just bruised it when masturbating,
or rough sex with your partner.
Best advise would be to see a medical professional.
Pain while urinating is often a urinary tract infection... and it's very important to go to the doctor for this or it will get worse. You can get these from different things, so it's nothing to be embarrassed about. The doctor can do a urine test and give you pills to help clear this if it's the case, or can help you figure out what it is if you don't have a urinary tract infection.