Low Magnesium Levels?!

I’m having a hard time with this pregnancy, I have had migraines, constipation, SEVERE leg cramps and now back pain and I can’t sleep through these pains. My Migraine got better after I reached 29weeks, constipation also eased, but insomnia, legs cramps and back pain are driving me insane, after taking blood test they told me my magnesium levels are low, I should be taking magnesium supplements, I started taking the one from Holland and Barretts 150mg, but then again when tested they were lower than last time, so they gave a prescription for chewable magnesium, 2, 3times a day. It didn’t help, and every time I take a blood drown surprisingly my levels are going downward. I asked what can cause this, but they said lets keep checking to see, so again today they prescribed a higher dose of mgnsm supplements. I was wondering anyone here with similar experience of low magnesiums and what was the reason for you? I eat healthy and am very careful about my food, but dunno whats causing this. Any insight?