The conclusion of this psalm serves as a passionate prayer for salvation and the gathering of exiles [מאירי, שטיינזלץ]. There are varying perspectives regarding when this prayer was composed. While some early sages suggested the author lived during the era of the Judges or the Babylonian exile, the primary approach among commentators is that these words were spoken with divine inspiration from a future perspective. They are placed into the mouths of the Israelites as they endure a long exile [אבן עזרא, רד״ק, אלשיך].
In their plea to be saved, the people ask that just as God showed them mercy in the past, He should rescue them now [רש״י, מצודת דוד]. They ask for a complete redemption brought about by God Himself, rather than through a human messenger [אלשיך, מלבי״ם]. The desire to be gathered from among the nations is not only a hope to return to the Land of Israel [מצודת דוד]. It is also a plea to be distanced from the negative influence of the surrounding nations and to escape the mockery the Israelites endure in exile when they bless God [אלשיך, שטיינזלץ].
The ultimate purpose of this salvation is to offer thanks to God's holy name. There is a distinct difference between offering regular thanks during exile and thanking His holy name. While gratitude in exile is a general expression, His holy name represents a miraculous, supernatural guidance that is deeply connected to the spiritual sanctification of the Israelites [מלבי״ם]. After enduring a long period of submission in exile, the people will no longer seek greatness for themselves; they will only desire the privilege of thanking God [אלשיך].
Ultimately, the Israelites seek the right to take pride and be uplifted through God's praise. This praise is made up of the many acts of kindness He performs for His people [רד״ק]. Consequently, as God's praise grows, the honor of the nation He chose increases as well [מצודת דוד]. Furthermore, this praise brings about a profound elevation. Through it, the people will be spiritually uplifted, aligning their paths to match God's character and striving to emulate Him in His mercy and all His other traits [מלבי״ם].