As others already pointed out the simple answer is that "purpose" is a concept that only exists within a rational mind. And rational minds are only known to exist in humans so far. Where does it leave us? Unless you believe in deities, we have to accept that purpose is a human concept and as such is a thing only humans can define. Who else? Considering that you will have a couple of options:

1. Listen to what smart people say and accept their belief about the purpose of life. (by the way most will agree with the above paragraph and accept there is no inherent purpose in life other than what we decide it should be).

2. Listen to what the majority of people say and go with it.

3. Define for yourself.

It is quite clear that number 3 is the one we would recommend, because only this way can you guarantee the purpose of life which you have defined is something that fits to your view in life.

In the end you will maybe see that the question about the "purpose" of life is a paradox. Life exists on itself, without us, and without us reasoning about it. So why would it need a purpose? A purpose implies that there is a design, a creator.

For this reason I dislike the terminology "purpose" and I rather like to say that we may choose to take on a life task.

Due to contrasting and negative experiences in my life I chose my task to be liberation of or from the mind. The basic idea is to liberate ourselves from constant pondering, worrying, and analyzing which our mind is doing constantly because we needed that to gain an evolutional advantage. But mostly we are unharmed today and not in peril, so our mind is underutilized and we develop psychological illnesses. This is my personal take, maybe yours will be different in the end, maybe it will be similar, who knows.

If you are interested to learn more, I can tell you that there are many many variations of it throughout history, some may call it religion, spirituality, meditation, zen, etc. In the end all of these things boil down to looking outside of yourself at the wonders of the world and inside yourself at your own feelings at same time in order to stop our attachment to the mind which is solely concerned with trying to reason about things which are inexplicable. And most religions, be it hinduism, buddhism, taoism, christianity, or whoever have similar takes on this. The idea is living in the present moment instead of in the future or past, where our mind mostly spends it's energy.

Nobody can tell you what the purpose of life is, you have to chose for yourself. If you choose to take on something which has stood the test of time and was formed over thousands and thousands of years, an idea forged by millions of people, you may chose to engage also in the art of letting go, of freeing the mind, of stopping to worry. Or as Patanjali the writer of the famous Yogasutra called it: Stopping to identify with the ebbs and flows of the mind.

There are so many ways to dive into this topic, like Yoga, meditation, or books like Eckart Tolle's "The power of Now", or even a lot more in popular literature. It has helped millions or billions of people in human history to engage in some form of meditative praxis or spirituality, for a good reason.