To appropriately fill in the blanks based on the context of the poem, you could use the following:
The author’s purpose in comparing each “mast and spar” to a "prison-bar," is to "create a sense of foreboding and emphasize the restrictions imposed by the British presence."
This comparison helps illustrate the mood and setting of the poem, highlighting themes of oppression and the looming tension of the historical context.