The problem is that the proteins that make up your muscles are also part of those energy reserves that the body is forced to resort to. Surely you want to keep your muscles or even develop them, but if you do not get enough energy through food, your body will get the protein from your muscles. This means that you will lose muscle mass. That is why it is so important that you consume enough protein despite the caloric deficit. And train correctly.
Training that aims at muscle development helps you burn fat. Well-developed and defined muscles burn more calories, even at rest , than flaccid and untrained muscles. Strength training also has another fantastic side effect. The muscles give more shape to your silhouette, so you can decide which muscles to work to get the desired figure. The most illustrative example is the buttocks because, if you perform the right exercise, you can give them the shape you are looking for.