To gain muscle, not fat, you need physical activity and balanced nutrition and rest (everything is important!).
Eat better, like in a sanatorium, 5 times a day.
Each meal should have 15-20 grams of high-quality protein (after exercise, 25 grams of protein is better).
Be sure to eat vegetables (especially from the green group) and drink water (about 30 g per 1 kg of body per day).
Good vitamin complexes can be added.
To begin with, I would advise you to count the amount of proteins, fats and carbohydrates consumed by you in food, to gain mass you need about 7-9g of carbohydrates and 2-3g of proteins per kilogram of your own weight, increase the number of calories consumed by 300 every day.
In this case, the daily rate should be at least 3000.
Drink more water, preferably at least 2.5 liters per day. (if you go in for sports, then + 1-1.5 liters)
Try to work out your meal plan so that it will be at about the same time every day.
There are also protein / carbohydrate drinks / bars.
Well, go in for sports.
Under these conditions, you will gain weight at a good speed.
I wish you more mass💪🏻
If you want to lose weight on fat, then eat high-calorie foods - you can even drink 100 grams of any butter, eat chocolates and cakes. If you want muscles, then only sports and a high protein content with a calorie surplus of + 10-15%