In a situation like that it's tough to be both honest and consoling. A fitting answer could have been "i don't know if there's life after death, but one thing i know for certain is that he lives on in our minds and hearts", but let's be real. Most of us aren't gifted with extemporaneous diplomacy. With no time to think the answer over, I would have probably said something really f'n stupid. All things considered, i think you did fine and shouldn't beat yourself up over it, but if it the thought of being a hypocrite gnaws away at you, do what i do. Make your views known to others early, through conversation, preferably at a boring time, when emotions aren't flying high (like at a funeral).
The cosmos is also within us. We're made of star stuff. We are a way for the cosmos to know itself - Carl Sagan