Reacting carbon dioxide with magnesium in ribbon form
The reaction you are working with is:  

$$\ce{2 Mg(s) + CO2(g) -&gt; 2 MgO(s) + C(s)}$$  

where the carbon should be primarily graphitic.  

Because you are producing two solids in this reaction, they will be physically intermixed and thus the purity of either solid will be poor, being contaminated with the other solid.  

The separation of carbon from $\ce{MgO}$ is a fairly straight forward process, however. Upon contact with water, $\ce{MgO}$ becomes the basic $\ce{Mg(OH)2}$, which is readily soluble in dilute hydrochloric acid. Once the $\ce{MgO}$ has been dissolved in acid, you can filter off the acid-insoluble carbon. After the hydrochloric acid has been evaporated off, $\ce{MgO}$ will re-form from the $\ce{Mg(OH)2}$.