Hello,
Having an infection is different from having cancer from smoking. Your doctor gave you antibiotics to kill the bacteria that have infected your lungs. A bacterial infection can causes back discomfort particularly when you breathe or move. I know this from having walking pneumonia. That took me a year to get over. I can't take antibiotics for that so all the doctor could do was give me a prescription for an Expectorant to make my cough more productive. I was coughing so much it caused me to throw up repeatedly so I had to stop taking it. I could barely breath. I found that walking everyday and increasing the amount of time I walked over time helped to clean out my lungs however it still took a year to get over it. If you are having sharp pains in your back that could be due to pinched nerves coming off the spinal column meaning your pain isn't in your muscles but rather emmanating from the spinal column making you think your pain is in your back. You might consider seeing a chiropractor for this.