So you have an MU42 headlamp! I presume you also have the 'claw'?
Place the spring inside the shell with the open end towards the front. Then put the hook of the claw through the slot and locate it on the short flat part of the sping in the middle. The claw should dangle down and have the spring resistance to hook it into the hole in the rim.