What's the pain I feel in my back when breathing deeply? Prev had chest infection. Xray done show no lung collapse but have slight pain near shoulder.

Inflammatory pain. "chest infection" or pneumonia can cause inflammation of the lining around the lung called the pleura and cause what is medically termed as "pleuritic pain" this can last upto 6 weeks from the time you had pneumonia or bronchitis. If it lasts longer then it may need further workup.
Possibilities... Sometimes with persistent coughing, musculoskeletal pain develops and can be due to pulled muscle, cartilage inflammation and even rib fractures. There is no specific treatment for this and it will resolve once the cough resolves. Shoulder pain can be musculoskeletal in origin but it can also be due to diaphragmatic irritation. This, too, will resolve once the infection is completely healed.