Hello Gerry
There are a number of possible reasons as to why your grill may not be staying alight.
As others have pointed out, most grills have a 'Flame Failure Device' (FFD). When you press the gas control knob, you are forcing open a small solenoid inside the gas valve. This allows the gas to flow to the burner. When you light the gas, the heat from the flame impinges on a thermocouple. When it gets hot it generates an electric current, which in turn holds open the solenoid built into the gas valve.
Consequently if the thermocouple does not get hot, or if the flame goes out, the thermocouple does not produce a current, and the solenoid closes, shutting off the gas flow. A similar system is employed in many gas appliances, but they do not necessarily use interchangeable parts.
In your case the symptom suggests the FFD has stopped working.
It could be that the flame pattern on the grill is not correct - rust of other debris may be occluding the burner, preventing the proper flame spread.
The thermocouple may be damaged - they live I a very hostile environment and will eventually fail through use.
The cable that joined the thermocouple to the gas valve may be damaged, interrupting the electric current.
The screw in coupling on the end of the thermocouple cable into the gas valve may be loose or corroded.
The solenoid may have become open circuit.
The fact that you have raised the question suggests that you may not have the necessary knowledge to diagnose or safely repair the appliance. So I am one of those who will tell you that to attempt any repair on any gas appliance you MUST be legally competent and know how to do the job, how to test and prove the system according to the regulations.