Your code is working like it should. It picks up the only food in the level, and since there's no more, it waits on that while(grub==NULL) line. What is it that you're trying to achieve?
If you add more food sources in your level, you'll have to face a little problem. If you assign all your food models to the same action, then the grub pointer will be assigned to the first food, then it will be overwritten and assigned to the second food source, etc. So when the game starts, the grub pointer will be assigned to the last food model. Your AI will go and eat it which makes the pointer NULL.
Take some time and learn about arrays so you can store ALL food pointers/handles to them, so if you eat the last one, it will go look for other food pointers in that array.
Cheers,
Aris