it works the same way as the oven in the kitchen
when you hold the button in it opens the gas valve
when the pilot is lit it sends a signal to the valve via a thermocouple witch keeps the valve open
near the pilot light there should be a probe that is being heated by the pilot light if this is not being heated by the pilot it will shut the valve off as soonas you release the button
if it is being heated it sounds like you may need a new thermocouple these are not expensive
eck hi
August 2008