It is very helpful when you start with using proper notation, i.e. $V(\ce{H2})=44.8~\mathrm{L}$. Proper notation like $M$ for molecular mass, $m$ for mass, and $n$ for amount of substance will help you follow through your thinking.
When do the calculations, always carry the units with every quantity you use.
It is necessary to know a few principle formulae, for example that molecular mass and mass are connected through the amount of substance: $$M = \frac{m}{n}$$
There are a few more you will need and with their repeated use you will get to know them easily.
When attacking this problem, find out how the quantities relate to each other. In this example it is: If I want to produce one mole of hydrogen gas, how many moles of magnesium do I need?
one, because $n(\ce{Mg})\ce{->}n(\ce{H2})$
A key principle (and asumption) in this exercise is the ideal gas law,
$$pV=n\mathcal{R}T.$$
You need it to calculate the amount of substance of hydrogen that should be produced.
(You have indirectly used it by dividing the given value by the molar volume of an ideal gas at STP.)
In this case about two moles of hydrogen gas shall be produced, i.e.
$\displaystyle n(\ce{H2})=\frac{pV(\ce{H2})}{\mathcal{R}T}\approx2~\mathrm{mol}$
(Old definition of STP: $p=1~\mathrm{atm}$ and $T=298.15~\mathrm{K}$)
Now you also know the amount of substance of magnesium you need.
two moles, i.e. $n(\ce{Mg}=2~\mathrm{mol}$
You just have to use the molecular mass of magnesium to find the mass of magnesium you need with the above connection.