Can I have insomnia, constipation and weight gain due to low magnesium?

Yes, you could. Magnesium (mg) is involved in over 300 necessary enzymatic reactions in the body. Blood level could be "normal" but tissue level (where mg is active) low. Eating a highly processed food diet predisposes many of us to mg deficiency. It could be worth a try to see if supplementing helps you -- can begin w/mag citrate or glycinate 150-200 mg per day w/meals. If loose stools, go more slowly.
Possible. Magnesium levels as well as othe lr electrolytes can cause all kind of issues mostly with muscle or heart and constipation question is what makes you think your magnesium is low?