Welcome in H.C.M.
I have gone through your query regarding cough
followed by clogged ear and finally start discharging pus.
According to your medical history it appears as you were having upper respiratory tract
infection in the form of cold and cough and this later extened to ear via eustachian tube thus you felt ear as blocked and later ear became painful. but infection in ear might have made hole in ear drum therefore the collected infected fluid from middle ear came out as discharge.
Now you should consult an ENT doctor for treatment and to avoid further complication.