The Medrash Rabbah (2:6) states: “What is meant by the word ‘laymor’ (to say)? Rav Azariah says this means to say to the coming generations that they should daven in times of distress because even though Moshe was told that he would not cross the Yarden, he began to pray.”
The Tiferes Shmuel explains that when a person is faced with a difficulty, he should recognize that it was sent by Hashem for his own benefit. Since everything is orchestrated by Him and He is completely good, this too must be good. Therefore, one must believe that the challenge he is going through is for his ultimate benefit, as the pasuk states (Yirmiyahu 30:7): “It is a time if suffering for Yaakov, and from it will come the salvation.” In other words, the suffering itself will lead to the salvation. This is as Chazal say (Medrash Tanchuma, Parshas Netzavim 10: “Just like the light of day sprouts from the darkness of night, Hashem will make light from out of the darkness.”
One way that suffering is for our benefit is that it brings us to do teshuva and return to Hashem. This is as Dovid Hamelech said (Tehillim 77:11): “I said that this is to terrify me, the change of the right hand of the Most High.” Rashi explains: “My thoughts tell me that this is only to terrify me and frighten me into returning to Him.” In other words, Hashem sends us suffering to scare us into doing teshuva.
This is in accordance to the Yid Hakodesh of Peshischa zy”a’s explanation of the verse (Tehillim 76:9): “From Shomayim it was judged, the land was afraid and was silent.” He explains that when there is a judgment in Shomayim that a terrible decree must be issued against Klal Yisroel, the only purpose is for the Jewish people to be moved to do teshuva. People on earth are meant to become scared and repent from their aveiros. If they do so, there will be “silence”, and the decree will not affect us.
Accordingly, the Medrash is saying that the word “laymor” means to tell future generations that when faced with difficulties they should not fall to despair. Rather, they should accept the fact that the suffering is for their benefit and is meant to bring them to do teshuva. And one should know that if they have emunah that the difficulty will lead to great blessing, they will merit seeing this blessing quickly.
In the Shabbos zemiros, we sing the words: “Mishoch chasdecha l’yodecha Keil kana v’nokem. Extend Your kindness to those who know You, Hashem who is zealous and vengeful.” With these words, we ask Hashem to show kindness to Klal Yisroel, but then say that He is strict and takes revenge. The meaning of this is that even when He is being strict, He is still being kind to us, as the strictness is meant as a prelude to His great kindness.