I am going to talk about gross things now. Just for everyone's information. Have you been tested for parasites? They are a lot more common than anyone realizes! I recently found out that I had parasites and I haven't been out of the country or anything. I constantly wash my hands. You should look into it.
Have you had your appendix checked? Pressing on the lower right abdomen and hurting indicate a problem with the appendix or a small hernia. - Please see a doctor. If your appendix is okay, then you might want to try taking a Weight Gainer. I buy these for my daughter who is underweight. Also Purple Cone Flower Root will give you a tremendous appetite. She has gained 10 pounds in one year. may not seem like much to most people, but it does to her as she has trouble keeping the weight on.
Wishing you the best
Have you had your thyroid checked? Weight loss/gain is pretty much what u eat and burn in a day, so if you are eating as many calories as you burn you won't gain any weight. there are trackers and calculators u can find here and other sites to calculate how many calories you are burning. you may just need more carbs and proteins. if ur doin all this already and ur still not gaining weight i would consult a dr. just to make certain everything is ok. good luck buddy.