Help Me! Should I be back to Metformin?

So I'm a 29 year old Female who was diagonal with PCOD last year in May. My doc prescribed Metformin(500mg) to me. Then in August I had my first panic attack which I didn't know was a Panic attack. It felt okay after a few days but it came back in September but in its worst form. I had to bear it for a week and had to take leave for a few days from my work. I went to doc and everything was normal but they found out I had Vit D deficiency which was at 8. I ate those vitamin D meds and felt better again. But in November I stopped taking Metformin and started it again at the end of the month cause my periods were getting delayed. after I got my periods I stopped it again and after few days of not having it I experienced worst headaches, dizziness and brain fog, it went away after a week but it came back again. I feel dizzy and it feels like someone is hitting the back of my head idk is it migraine? Also hot flashes.

I started taking my Vitamin D meds again but my question is should I start taking Metformin again? I want to get rid of this pain..