I feel like a failure

I’ll be the first to admit that I haven’t had an easy pregnancy at all. Well now I feel like a failure. I went in for a WIC appointment since I have been having some financial trouble due to not being able to work. And I couldn’t believe my eyes. In just the past week I somehow managed to lose 5 pounds. I’m 22 weeks. 5’4” starting weight was 185. A week ago I was 190 almost 191. How in the world did I lose the weight is beyond me. I have been eating the same as I have this whole pregnancy. If anything I have been eating more recently. I’m just so discouraged at this point on what I’m doing wrong. Every doctors appointment has been normal and baby has been healthy. But yet I haven’t gained enough weight. I just want my baby girl to have the world. Any advice on how to gain weight?