RideFreak is right of course, but you do not have the US XR400 model. The wiring on the pics is similar to the Euro models maybe you have that one. If so you have a little more power to play with as the Euro models have both DC and AC (extra winding/coils on the stator for DC. The USA models dont have it.)
3.7 Ah battery is not that small, the HID light should not die right away when the bike idles.
As far as I can see from the pics you have wired the light the wrong way. I think you need the green and black wires, but check for polarity.
Aslo if you have been experimenting with the battery, and connected it the wrong way you may have damaged it. Do not assume it is OK when you troubleshoot.