The purpose of life is not to be happy. It is to be useful, to be honorable, to be compassionate, to have it make some difference that you have lived and lived well.
Ralph Waldo Emerson (1803-1882) American essayist, lecturer, poet
(Misattributed)
Though widely credited to Emerson, this appears to be a misattributed variation of a Leo Rosten quotation. More discussion of the connection here: The Purpose of Life Is Not To Be Happy But To Matter – Quote Investigator.