Thanks for your query.Based on the facts that you have posted it appears that you have a small lump on shaft of the penis just near glans penis
This could be a boil or a sebaceous cyst
however final diagnosis can be confirmed only on clinical examination .Please consult qualified Urologist
for clinical assessment. You may need to take antibiotic and anti inflammatory medication for couple of days.
The yellowish discharge you had may be excessive secretions of the periuretral glands.
Do not worry this can be cured with medicines.