Hello
Thanks for your query.Based on the facts that you have posted it appears that you have either a
Staphylococcal infection of the hair follicle or Sebaceous
cyst over the shaft of the Penis.
However final diagnosis can be confirmed only on clinical examination.
Please consult qualified
Urologist or
Dermatologist for clinical examination to confirm the diagnosis.
Take some antibiotics like Doxycycline twice daily for a week.
If problem persists even after taking antibiotics you may need to get it excised under local anaesthesia.
Dr.Patil