Psalms 107:3

And gathered them out of the lands, from the east, and from the west, from the north, and from the south.

Those spoken of are the redeemed of Jehovah, rescued from the hand of the adversary, who are called to say so and to give thanks to Him because He is good and His loving-kindness endures forever. He has gathered them out of the lands, out of distant places from the east and from the west and from the north and from the south. That gathering is from every direction, bringing the redeemed in from far-off lands.

What follows tells of their wandering in the wilderness, their cry for help in trouble, and His deliverance in leading them to a settled place to live. This is part of the recorded history of the Israelites, given to help readers appreciate more fully God's goodness and mercy and love. The psalm itself teaches the need to appreciate that goodness and mercy and love.