Thanks for your query,based on the facts that you have posted it appears that you have developed two fluid filled bumps on your penis after masturbation
and have been diagnosed to have acquired syphilis
Please note that one can acquire syphilis only if one has sexual intercourse with a woman known to be positive for STD .
The bumps that you have on penis may be due to dry rough handling of the penis duering masturbation .
You need to take broad spectrum antibiotic like Cefexine along with anti inflammatory drug like Diclofenac
twice daily.along with topical antibiotic
ointment like Neosporin
Ensure to wash your genitals with warm water twice daily
Ensure to avoid sexual encounters till it heals up completely.