Romans 15:4

4 For everything that was written in the past was written to teach us, so that through the endurance taught in the Scriptures and the encouragement they provide we might have hope.

Read Romans 15:4 Using Other Translations

For whatsoever things were written aforetime were written for our learning, that we through patience and comfort of the scriptures might have hope.
For whatever was written in former days was written for our instruction, that through endurance and through the encouragement of the Scriptures we might have hope.
Such things were written in the Scriptures long ago to teach us. And the Scriptures give us hope and encouragement as we wait patiently for God’s promises to be fulfilled.