The things that happened to those people are examples. They were written to be warnings for us. We live in the time that all those past histories were pointing to.
Everything that was written in the past was written to teach us. Those things were written so that we could have hope. That hope comes from the patience and encouragement that the Scriptures give us.