Welcome to e health forum.
Severe intensity of coughing can cause excessive negative pressures within the respiratory tract, and this can cause mucosal tears and hence the blood in the mucus.
In case this was a single episode and has now stopped, then taking rest and inhaling steam should help you get some relief.
In case the coughing is persistent, and there is continuous blood in the mucus, then you should immediately seek medical attention and proper help.