The floor for a healthy BMI is 47.5, and I sort of dance around that, with action required by me when I dip. My body fat is under 20, but I have excellent muscle mass, without any bulk. I'm now a very wiry old bird. I think my ideal would be c50kg, with anything added going to my arms, but let's face it the arms bit is never going to happen, is it? Such is the rule of Murphy.
Adding weight is very tricky, and these days I have more options, but in your shoes, I'd up the protein a bit. By that I mean, if you'd normally have, say, a chicken portion, make sure it's a decent sized one, or if you're looking at bacon, have an extra rasher. Then for the fat, things like a cheese sauce on your veg can be absolutely fabulous - especially if you make your sauce without adding any flour. If I have cream in, I'll use that, whilst warming it, I just throw in enough cheese to achieve the texture and quantity I want.
On top tip I would give you is when gaining weight, do a bit of extra moving around if you can. I don't necessarily suggest you become a gym bunny (I'm not), but just park further from the supermarket entrance or whatever, or walk on local errands, rather than jump in the car. That'll maybe help you ensure you're gaining some muscle if you can. I appreciate moving around/exercising uses energy, but it's a balancing act.
Touching on your interest in my "more carbs now" comment, like many others, as I trimmed up, my insulin resistance significantly improved. I can't think the last time I saw a 7 on my meter, including the Libre, which tracks and graphs 24/7, so no hiding!
I can't stress enough that I am incredibly fortunate to end up in the place I currently am with my diabetes, and health overall. Not everyone's body can recover quite so well, but I'd urge you to do as you are and try your very hardest. Hopefully you can get back under that magic number (42). I can't say strongly enough, at this stage, testing is critical for you. The reassurance it gives you (as well as some inevitable frustration and disappointments!) is wonderful.
Whilst being underweight isn't good, as you're testing and experimenting, many people lose weight, because the do things like reduce their carbs, and replace them with, usually, vegetables, so many lose weight. I might suggest that your first couple of weeks target would be to maintain your weight, with any gain a ginagerous bonus. Just take it steady, this is the long game.