“All has been heard.” Of course “everything” has not been heard. This is a hyperbole to emphasize that everything has been heard that people need to see how life works and what is important in life.
“the whole purpose of humankind.” In the Hebrew text, the phrase is, “for this is the all of humankind.” Although the REV adds “purpose” for some clarity in English, in essence, James Bollhagen (Concordia Commentary: Ecclesiastes) summarizes the phrase well: “...translations with added words [such as “duty”] actually limit the force of the statement, which is much more comprehensive than that. In this context כָּל־הָאָדָֽם [all of humankind] means “the entirety of man,” that is, the sum and purpose of human existence. The essence of living and being a person can only be understood in terms of a person’s relationship to God.”
God created humankind, and He created them for, and with, a purpose. God did not create people so they could be self-willed and live any way they chose. He created them to love Him, fellowship with Him, serve Him, and be blessed and be a blessing. Ephesians 2:10 says we were created to do good works. All of human life is designed to be in relationship with God.