Pain under the left rib with loss of appetite for six months and recent acidity usually points to gastritis or acid reflux, sometimes with H. pylori behind it. Six months of poor appetite is what I take seriously, that is long enough to need testing rather than just antacids. A pantoprazole course, fixed meal timings, no alcohol or smoking, and cutting late-night heavy meals is the starting point. Weight loss, black stools, vomiting, or pain that wakes you at night needs an endoscopy without delay.
Next Steps
Get a CBC,
LFT, an ultrasound of the abdomen and an H. pylori stool antigen test done. Bring those reports on a Practo consult with me and I will decide between medicines and endoscopy.