Thanks for your query. Based on the facts that you have posted it appears that you have developed what is called as Sebaceous cyst
on the shaft of the penis .
Take some antibiotics like Doxycycline twice daily for a week after getting prescription of this drug from your family Physician.
If it does not subside then you will have to get it excised in Toto under local anaesthesia by a general Surgeon