Normally, to lose fat you need to give the body less calories than it can burn, but if you need to build muscle, you need to take in more food or calories. The principle behind this is to eat more when you are training and less when you are resting so that you have enough for energy utilization and recovery. If you don’t have enough calories, then the body will take the energy stored in the muscles which will deplete them of their strength and affects metabolism.
Although carbs are important in the muscle building process, they can be stored as body fat so it is important to take care of the amount of carbs you eat. When you eat carbs after training, it raises the insulin hormone that favors the rebuilding of muscle mass and stabilizes testosterone levels. Steer clear of eating a lot of carbs on your rest days as it may be stored as body fat because you are not burning as many calories, this tends to keep insulin at bay hence no carbs will be directed to the fat tissues.
Do exercises that will help build muscles and less of those that burn fat, such as cardio, because when you build muscles you will be burning fat even after you are done with exercising. Strength training will help increase flexibility, strength, and muscle endurance hence build more muscle and burn more fat.