It is a vicious cycle trying to balance the calories: to have enough to sustain us with enough energy for our day and activities, not over doing it with calories to increase our weight, and too little to reduce our metabolism. Then when you add in health issues, it makes it even more challenging and compound each of those factors. It can be hard to find the right balance.
It can be good to talk with doctor and checking in with a nutritionist about what is going on with your health and your goals. Meanwhile, this might help as a beginning guide for calories:
CalorieKing - How Many Calories Should You Eat
This is not an absolute, but a general guide, and depends on other factors such as exercise, muscle mass, and daily routines. Hang in there. It takes time and patience to find the right combination but you will find it. No matter what, do what you need to to take care of you.