One way of looking at the whole drama of human life is to see it as one of the avoidance of suffering and the attainment of happiness. Be it a young person seeking a job, a young parent raising a child, a middle-aged person taking care of aged parents, all of those actions and endeavours are seeking to avoid misery and attain happiness both for oneself and others to whom one is related by close ties. Even if you take the case of people like Buddha, Jesus, Einstein, Gandhi, Winston Churchill, Rockefeller, Martin Luther King jr., or Mother Teresa, they were all seeking to end human suffering and thereby contribute to human happiness, howsoever different be the causes they were serving, the goals they were pursuing and the methods they were using. Even the Sanyasi meditating in the Himalayas is seeking precisely what everyone else is seeking, namely, the end of suffering and the attainment of happiness. The only difference is that different people seek happiness through different means and in different ends depending on their level of evolution and understanding.
However, people like Buddha and Ramana Maharshi tell us that as long as we are seeking happiness through external means and circumstances we are not going to attain lasting happiness, and moreover, the whole search for happiness is based on the wrong premise that we do not now have happiness but somehow have to find it through our search and work, etc. But, they point out, happiness is our very nature and the only thing masking that inner happiness is the incessant working of our mind, thinking that we have to seek happiness outside of ourselves. This is Maya, that although our very nature is happiness, we are constantly seeking it outside and thereby getting frustrated for the major part. So, to put it simply, the purpose of life is to come to the realization that happiness is our very nature and we need not seek it outside, at which point life becomes a celebration because we are not working for happiness but working out of happiness as a way of expressing our inner nature and personality.