Moses did not mention the afterlife. He said "Do this, and you will live". But there certainly are verses in Psalms that allude to the afterlife, though it is not a major topic: Psalm 16:9-11; Psalm 49:14-15; Psalm 73:23-26. Yet there is a book in the old testament that has the afterlife as its major topic, and that book is: Ecclesiastes, one of the wisdom books of the bible.
What does the word "vanity" mean? Definition number one in the dictionary is: "excessive pride in or admiration of one's own appearance or achievements". That's the wrong definition. Definition number two in the dictionary is: "the quality of being worthless or futile". That's it! Vanity means futility, uselessness, pointlessness, worthlessness, fruitlessness. What does the author of Ecclesiastes say is futile, useless, pointless, worthless, fruitless and vain? Look at 1:5 "The sun rises and the sun sets, and hurries back to where it rises". He is talking about the creation! The author is criticizing God's creation! This earth, that God created is: futile, useless, pointless, worthless, fruitless and vain.
You're not supposed to believe this statement at face value! You are in philosophy class, you are required to think.
9:4 says that a live dog is better than a dead lion. Is that true? Is there nothingness once you are dead, as the author implies? Is the fate the same for the righteous and the wicked as stated in 9:2? If there is nothingness once we are dead, that one could logically ask why God made us in the first place. You might even conclude that the creation is vanity. However, if you think about it, you may decide that it is untenable that God would create futility, uselessness, pointlessness, worthlessness, fruitlessness and vanity, and that it follows logically, that there must be an afterlife.