I am 17, and I used to be really skinny, but I had great cardiovascular health. I decided to bulk up and I started bodyweight exercises and ate at a surplus. The thing is, I gained a lot of fat and muscle, and I don't want to lose the muscle completely while burning fat. I am 170 cm and during the summer, I was 52 kg; now I am 65 kg. I want to drop to 60 kg and do a recomp, I know recomp is possible only for beginners but I only exercised muscle for 5-6 months. When I was skinny I did go to a gym but I only got skinnier so yeah I think I can do it but I don't know how.
You need to reduce your calorie intake so you have a small calorie deficit (around 200kcal/day would be good, 500kcal/day as an absolute maximum) - this will facilitate the weight loss. However at the same time you need to be very disciplined with what you eat, maintaining a high protein intake and continuing to work out is key to maintaining your muscle mass.
Be careful not to try and lose the weight too quickly - at 17 it is possible you are still growing, and your body needs the fuel to do so.