Could you cough up a piece of your lung?

No. You might cough up any number of unusual things that look or feel like lung tissue or have the form of bronchial tubes. These are normally dried up or hardened mucus, sometimes coagulated blood, occasionally purulent (pus) material.
Very rare.... It is very rare! so, if you think you are coughing up lung tissue, save a sample and show your doctor. Chances are there is another explanation!