Alright, well it's very innefficient to try and lose fat and gain muscle at the same time. To lose weight, you need to take in less calories than you expend during the day. To gain muscle you need to take in more.
So Id reccomend cutting first to lsoe the fat. Do a lot of cardio, eat healthy, and keep lifting weights. You won't see many gains, but it'll keep you from losing strength.
Then, when you're thin enough to be happy, you're gonna ruin it. Go on a bulk. Eat high calorie, high protein foods and lift like a beast. Limit cardio, and you will gain some fat. However, you will also gain some muscle, and then, when you cut again, to lose that fat, you'll end up ahead of where you started.