It’s “maintain” muscle mass, not “gain” ,the op is asking about, she doesn’t want to lose muscle as she loses weight.
losing muscle as you lose weight is the same for any diet, it’s impossible not to, for example my gym scales said at 15 stone I’d 7 stone of muscle. There is no way for me to be 10 stone, with 7 stone of muscle, obviously, I need water, fat, and a skeleton. So I will lose muscle. I need to.
the op is correct it’s about reducing how much we lose, and ensuring you get to the end and your goal weight with a healthy proportion of muscle for your weight. That’s the key. Depends on how much muscle you had to start with too, I always worked out even fat, so my muscle mass was high to start with.
op, I do the gym 5 or 6 days a week, I do a mix of treadmill, bike, elliptical, rower, climber, upper body weights and squats and sit ups/core exercises. When on the cardio machines I have them at the hardest/highest resistance setting I can tolerate, ie rowing at max resistance, or walking /cycling up hill fast, which helps retain muscle.
I also ensure I consume enough protein, or try to, so far, I’ve lost about 38 lbs which is about 5lbs of muscle the rest fat. So my muscle to fat ratio in my body is staying high, and is now higher than it was when I started, I will lose more, as I’ve another 2 stone to lose, and I’m ok with that, as long as I maintain a high muscle mass for my weight and height.