If you're able to light the pilot light, but it goes out when you release the control knob, the thermocouple probably needs replacing. The thermocouple is a safety device that shuts off gas flow if it senses the pilot light is out, but when damaged it loses its regulatory ability.