Hello and welcome to healthcare forum.
Your history and symptoms are suggestive that you are not completely cured from pneumonia
as you still have productive cough
that is infective as it is yellow and chest pain
Go for lab test of culture and sensitivity of your sputum which will detect the causative bacteria as well as proper antibiotic against them. After that consult your doctor with this report for further management.
Best wishes for your health.