The exposure to pollution , smoke etc causes such carbon collection over mucous membrane inside... so while coughing that layer comes out..so the colour... Nothing to worry if repeated Coughing and related sign history is not there.
Next Steps
Can put warm any available edible oil or ghee into nostrils daily once... around 3 or 4 drops to each side by laying supine position... at empty stomach... this cleans the mucous by making a protecting
lipid layer inside the respiratory tract.