Thanks for your query,based on the facts that you have posted it appears that you have bleeding in subcutaneous plane of your penis due to injury to one of the dilated tributaries of dorsal vein of penis .
You have not mentioned about whether it happened after injury or masturbation
Please consult qualified Urologist
for clinical assessment and further treatment,
You need to take broad spectrum antibiotics like Cefotaxime
along with anti inflammatory medication like Diclofenac
twice daily .and apply topical ointment like Thrombophob twice daily.