Even if you only eat pure sugar, as long as you eat less than you burn, you’ll loose weight. You would of cause get scurvy and all other kinds of disease, but you’ll still loose weight. Your body can’t produce something out of the air, that’s thermodynamics 101.
OTOH, if you eat a lot of shitty food, it can very well be the case, that you just get enough essential nutrients by the sheer amount of food you’re eating. That would mean that by cutting the amount without changing what you eat, you’d get into malnutrition.