It was a lesson, not a sentence.

For whatever was written in earlier times was written for our instruction, so that through perseverance and the encouragement of the Scriptures we might have hope. Romans 15:4

“Only give heed to yourself and keep your soul diligently, so that you do not forget the things which your eyes have seen and they do not depart from your heart all the days of your life; but make them known to your sons and your grandsons.” Deuteronomy 4:9
“Remember the days of old,
Consider the years of all generations.
Ask your father, and he will inform you,
Your elders, and they will tell you.:” Deuteronomy 32:7
“Do not be like your fathers, to whom the former prophets proclaimed, saying, ‘Thus says the Lord of hosts, “Return now from your evil ways and from your evil deeds.”’ But they did not listen or give heed to Me,” declares The Lord. Zechariah 1:4
Now these things happened as examples for us, so that we would not crave evil things as they also craved. Do not be idolaters, as some of them were; as it is written, “The people sat down to eat and drink, and stood up to play.” Nor let us act immorally, as some of them did, and twenty-three thousand fell in one day. 1 Corinthians 10:6-11
That there be no immoral or godless person like Esau, who sold his own birthright for a single meal. Hebrews 12:16