Dr. Burk has asked me to take a look at your question. It is most likely not your appendix. Appendicitis doesn't tend to hurt for several months. You need to see your doctor, an urgent care center, health department, free or sliding fee clinic for your symptoms.
Since this pain only occurs when you are coughing, it is more likely to be a hernia. That is a weakening of the abdominal muscles that allows the contents of the abdomen to push through. This can be quite painful, and it can be dangerous since if a loop of bowel pushes through, it can get "stuck" or strangulated and have its blood supply cut off.
The medical provider will also be able to check on your cough since no one should be coughing for 6-7 months without relief.