When you quit smoking it can take from 1 to 9 months to fully stop coughing up stuff.
During that time your cilia starts recovering and when the cilia recovers it clears out the mucus better from your lungs.
So after 9 months of stopping smoking you shouldn't be coughing up mucus or phlegm as much.
Usually when you stop smoking you tend to cough more in the beginning then overtime the coughing decreases.