Optical pumping and laser cooling of Magnesium atomic beam in metastable states