First you will need to write out your balanced equation, if the metal is magnesium as you stated, the equation is Mg + 2Hcl ---> MgCl2 + H2
Hcl Moles = conc x volume/1000 = 0.02 which you got, now due to the balanced equation Hcl and Mg are the 1:2 ratio so number of moles of Mg is 0.02/2 = 0.01
Now using the equation Number of moles = mass/ Mr
Number of moles x Mr = mass
so = 0.01x24x = mass of Mg = 0.24 g
The mistake doesnt effect gas produced as the Hcl is already in excess