Taking in more calories, weather through protein shakes or bags of sweets, will increase your weight.
If you want to lose fat, you have to get a calorie deficit, this means take fewer calories in then you use up.
If you want to build muscle or build any body mass, you need to take in more calories then you need. Simple as.
Doing both at the same time is very difficult if not impossible. You need to decide on one as when you lose weight, you lose some body fat and some body muscle. Its not something you can prevent (the muscle loss) its down to your age, your fitness level, your genetics.... nutrition can help but it wont make all the difference. Work on getting your body fat down and keep the muscles you do have updated with exercise: if you don't use it, you lose it springs to mind. You may be able to gain a very small amount of body muscle but it wont be a great deal and in many cases keeping what you have going is enough of a battle!
Keep resistance work up, keep cardio work up, both will help you take the edge of the calorie deficit. But more then anything else with weight (fat) loss, you need to watch what you eat and how many calories you eat. There are no foods (or shakes) that will magicly make you lose weight, its all in the calories. But keep your body in good health and keep the nutritional balance, eat enough protein to support yourself, eat enough fresh fruit and vegetables (potatos don't count!) drink enough plain water, watch your sugar, salt and fat intake, (you need some fats, up to 70g a day, but not more then this.) If you keep your nutrition levels happy, it will feel much easier to watch your calories as your body wont be craving any nutrients it lacks.