Hello,
Thank you for asking your query at DoctorSpring.
The back pain is due to the repeated coughing. During cough there is sudden movement of the intercostal muscles and some individual muscles of the back. These muscles are attached to the spine. So naturally when there is repeated cough the muscle attachment becomes sore. You need not worry about this pain. Once the cough resolves this will also resolve.
If the pain is troubling you, you can take an OTC pain medication like Ibuprofen 400 mg twice daily. I also recommend steam inhalation through nose, which will help in reducing the cough symptoms.
Hope this helps
Please feel free to ask followup questions
Thank you