First, look at calories.
Your body needs "x" amount of calories to function every day. If you want to gain, you need to eat more than that "x" amount. If you want to lose weight, you need to eat less than that "x" amount.
Second, look at food.
You need to see where your calories are coming from. High quality Protein, Complex Carbs, and Good fats.
If you are trying to lose fat, you need to do it slowly. If you decrease your cals too quick, you will slow down your metabolism ( which is not what you want to do).