It is ok to exercise to lose weight. However, first check with the doctor you consulted whether there is a hormonal
problem leading to weight gain and if there is any restriction to doing any type of exercise. If not, you should try to achieve a steady weight loss
by dietary adjustments and disciplined physical exercise. Do not try crash diets and do not over exercise. Good luck and good health to you.