You need to see a doctor. There are several things this can be. The first is bronchitis or pneumonia. Your doctor can tell you what is going on for sure and get you the proper treatment.
if could be any of the following
Blood clot in the lung
Inflammation of the blood vessels in the lung (vasculitis)
Inhaling blood into the lungs (pulmonary aspiration)
Irritation of the throat from violent coughing
Nosebleed that drips blood down into the lungs
Systemic lupus erythematosus