Stomach pain as you are describing is very common. It can be caused by a number of things, ranging from mild to serious. You should talk with a physician about this pain, and be prepared to ask about some of the following possibilities.
If the pain in your abdomen is diffuse and worsens with coughing, it is like a strain or tear in the muscles of your abdominal wall. These muscles include the rectus abdominus, the external obliques, the internal obliques, and the transversus abdominus. They may be injured over a long period of time by over use or acutely through sports or coughing fits. These types of injuries tend to improve over time with rest, but if your pain has persisted, you should see a doctor
More rarely, abdominal pain
with coughing could represent a problem within your abdomen. If an inflamed or enlarged structure, such as the gallbladder, colon, or appendix, moves with coughing, it may irritate the internal lining of your abdomen (called the peritoneum). This would likely be an acute process, but inflammation can also be chronic. A physician would need to examine you and learn more about your complaints to determine of any imaging or blood tests are necessary.
It is not possible to diagnose the cause of your hurt stomach muscle or to predict how it would be best treated without being evaluated by a doctor. For the pain you describe, I suggest you make an appointment with a primary care doctor
in person, who can then refer you to a specialist if needed.