I'm afraid you can't. Many hydrated metal salts, when heated, do not only loose water, but also acid. So, in your case you may end up with HCl fumes, water vapor and MgO as a residue.
I'm not sure about MgCl2.6H2O, but I know a similar thing happens with MANY hydrated metal salts, e.g. FeCl3.6H2O, Mg(NO3)2.6H2O, AlCl3.6H2O, Cu(NO3)2.3H2O. They all loose acid on heating, leaving a basic metal salt at best or being completely decomposed to the oxide/hydroxide.