Why does the Psalmist in Psalm 118 find the Lord’s discipline great evidence of the Lord’s lovingkindness? Because the alternative to not being disciplined in a season of sin is to be left in it and not brought back out of it. Accordingly, the author of Hebrews expounds upon the benefits of discipline in ch.12, in which he states that discipline is proof of being a child of God, for any type of loving father knows that disciplining the children is necessary.
So the Psalmist recognized the love of the Lord in his discipline because it didn’t culminate in his death. Moreover, it’s duration and intensity was carefully designed to bring about this result in the Psalmist and consequently in all the people. Not one extra minute or one additional ounce of pain was allowed beyond what God intended.
So discipline does not negate the Lord’s everlasting love; indeed it is evidence of it. Any loving parent teaches his or her child that sin has consequences and such is the same with our heavenly Father towards his people.