Old school retribution. The Old Testament is dripping with it. It’s a reminder of the price to pay should they disregard the words of the New Testament.
God is love. So every command, every punishment ever dished out was solely for our benefit and welfare. What the Old Testament shows is that no matter how God tries to entice us, either through encouragement or punishment, we simply don’t want much to do with Him.
That should tell us much of how “loving” we actually are when we want to reject perfected love.