Hey gabriel, welcome!
If you are planning on running a caloric deficit in order to lose some weight, then chances are you will lose some muscle mass. But, if you take certain steps you should be able to minimize the amount of muscle loss. The 3 main things that you should do are:
1. Strength training
2. Eat an adequate amount of protein each day
3. Incorporate HIIT into your weekly schedule if possible
Strength training is absolutely necessary if you want to prevent some muscle loss while losing weight. A full body routine 3 days per week should be adequate for most people.
I should ask... What are your exercise and nutrition plans for losing weight?
As for how much protein you should have per day, I'll take a quote out of a great article here:
1 gram per pound of total body weight if you’re relatively lean
1 gram per pound of lean body mass if you’re overweight
1 gram per pound of goal body weight if you don’t know your lean body mass
Yes, this amount of protein is above the amount recommended by the RDA. Keep in mind though that the research that’s the basis for the RDA’s recommendation is antiquated by a few decades. In fact, if you’re in an energy deficit, protein requirements can actually go a bit higher than this. It’s one of the few things that’s in our control as far as muscle preservation while dieting goes. It also does some nifty things in terms of satiety and energy expenditure. In the case of a calorie deficit, 1 – 1.5 grams would be a suitable range for the above formulas. For anyone else, .8 – 1.2 grams will suffice.
The rest of that article can be found here:
Nutrition 101 - Part 2 [Vitamins And Minerals, Carbohydrates, Fat Loss, Protein] - Fitness.com
That nutrition article is in 6 parts and I would recommend reading all of them
As for incorporating HIIT (high intensity interval training) - most people will never actually do true HIIT, but if you can eventually incorporate 2 interval workouts each week where you do a higher intensity interval followed by a low intensity interval, it's better than always doing steady state cardio. HIIT has been shown to preserve muscle mass better than steady state cardio, but HIIT is something that needs to be worked up to gradually to avoid injury!
Numbers 1 and 2 from above are the most important and are absolutely necessary for preserving (or gaining) muscle mass, especially while in a caloric deficit. If you follow those 2 rules, you should be good to go!