What tool is needed to remove a Shimano HG-50 freewheel?
EDIT:

This is an HG 50 Cassette.




This is an exploded view of a Shimano freehub showing the 10mm or 12mm allen key used to remove the freehub from the hub shell. I believe this is the allen you are referencing, but it need not be removed to remove the gear cluster.

Instructions for removing either a cassette or a freewheel can be found here.

If it is truly a freewheel. then this is the appropriate tool, the Park FR-1:



If you need a cassette remover, then this is the appropriate tool, the Park FR-5:



along with this one, or a similar chain whip:



I hope that is helpful.