Psalm 102:18–22 is one of the most visually layered passages in the psalm, and it pivots the entire prayer from individual lament to eschatological hope. Here's how the imagery works:

The Scroll for the Unborn (v. 18). The psalmist reaches for the image of inscription — writing something down so it outlasts him. The phrase "a people yet to be created" (עַם נִבְרָא) is striking: it uses בָּרָא, the same verb as Genesis 1:1. The generation that will read this testimony doesn't exist yet. The imagery is of a man in affliction writing not for his contemporaries but for a future people whom God himself will call into being. It's a prophetic act of literary hope — the sufferer composes for readers he'll never meet.

The Heavenly Stoop (v. 19). The scene shifts dramatically upward. God looks down "from his holy height" (מִמְּרוֹם קָדְשׁוֹ), from heaven to earth. The spatial imagery is vertical and vast — the transcendent God bending his gaze to the ground. This echoes Psalm 113:5–6, where Yahweh "humbles himself to behold the things that are in heaven and in the earth." The image communicates both sovereign distance and compassionate attention: he is infinitely high, yet he looks.

The Dungeon and the Death Row (v. 20). What does God see when he looks down? Prisoners groaning and "sons of death" (בְּנֵי תְמוּתָה) — people appointed to die. The imagery is of a dark prison, chains, condemned men awaiting execution. The "groaning" (אֶנְקַת) is visceral — it's the sound of people crushed under weight, not articulate prayer but raw, compressed anguish. And God's purpose in looking is not observation but liberation: "to set free those who were doomed to die." The prison doors open from heaven.

The Pilgrimage of the Nations (vv. 21–22). Now the imagery opens out into its widest frame. The freed prisoners don't scatter — they gather. They "declare in Zion the name of the LORD, and his praise in Jerusalem." The image is of the holy city as the destination of liberated captives who become worshipers. Then verse 22 expands the lens to peoples and kingdoms assembling together to worship Yahweh. This is the eschatological ingathering — the centripetal pull of Zion drawing the nations. The individual sufferer's prayer has opened into a vision of universal worship.

The Theological Arc of the Imagery. The movement across these five verses is remarkable: from a scroll written in obscurity → to the throne room of heaven → down into a dungeon of groaning → out through open prison doors → and finally into the gathered worship of all nations in Zion. It's a descent-and-ascent pattern that resonates deeply with the gospel: God stoops from glory to hear the condemned, liberates them, and brings them into corporate praise. The "people yet to be created" who will read this testimony and praise the Lord — that's the church reading this psalm now.

For your Romans 8 work, this passage connects naturally to Romans 8:19–22 (creation groaning) and 8:21 (liberation from bondage), and the "sons of death" set free maps onto Romans 8:1–2 (no condemnation, the law of the Spirit setting free). The Psalm 102 imagery of God hearing groaning from heaven also parallels the Spirit's intercession in Romans 8:26–27 — inarticulate groaning that reaches the throne.