The gas valve has a separate pilot gas circuit in it. When you push the button, you're opening the pilot valve manually. The thermocouple at the pilot assembly is heated by the pilot flame, until it sends a strong enough signal to the gas valve. If the thermocouple sends no signal, the pilot flame won't stay lit, and the main burner won't get gas, because the main gas valve does'nt open.
Your problem could be caused by a loose thermocouple connection at the gas valve.
There are two ways thermocouples are connected to the gas valve, jam nut and screw terminals. If it's a jam nut, gently tighten it. If it's the screw type, may sure the screws are tight. When the connection is tight, try to light the pilot again. Please post back with the result.
I just thought of another question. When you hold the button on the gas valve in, does the pilot flame light?