First time mom

This is my first pregnancy when I found out I was pregnant I weighed 240 I’m down to 228 I have no appetite I rarely eat anything I want to the doctor today for my 5months to check on the baby’s heartbeat is Is 152 so that’s good but my doctor told me that it’s not good for me to be losing so much weight and that I need to either stay where I’m currently at or gain some weight bc it’s not good for my baby thought I was doing good now I’m worried that I won’t be able to keep a steady weight please give me your advice