Hello and welcome to healthcare forum.
first of all you should mention your height,weight and age.
To gain weight you can start high protein and high calorie diet. prefer milk and milk product. Good balanced healthy foods like rice,banana,mango along with regular weight bearing exercise is much better rather going for any medicine.Underweight
occur due to improper eating habits or chronic disease condition like T.B. so, if there is no weight gain by above mean till 6 months then consult a doctor for evaluation.