Some things, like feelings and thoughts, are definitely real. Descartes famously said, "I think therefore I am", meaning that doubting our own existence proves that we are real - something which does not exist would not be able to doubt or think. Therefore, we cannot conclude that life is purposeless purely for lack of certainty of our own existence, as even thinking proves our own existence.
In philosophy, Occam's razor can be used to negate this argument. This is the idea that the argument which requires the least assumptions is most likely the correct one.
Believing that everything around us is an illusion requires more assumptions than it does to just assume that this is all real - believing none of this is real requires the disregard of every sensation, thought, and experience we have ever had. Therefore, it is the best and most sane option to live as though our waking life is real, meaning that any of the purposes of life, whether that be happiness, survival, or doing good, can be considered real and valid.