Solomon speaks about events that he thinks could happen in the future. The situations he describes in verses 36-38 are conditions for what he requests verse 39.
This can be stated in active form. Alternate translation: "where their enemies have taken them as exiles" (See: [[rc://en/ta/man/translate/figs-activepassive]])
# We have acted perversely and sinned. We have behaved wickedly
These two sentences mean the same thing. Together they emphasize how bad the people's actions were. (See: [[rc://en/ta/man/translate/figs-parallelism]])
# acted perversely and sinned
The words mean basically the same thing and emphasize how badly the people sinned. (See: [[rc://en/ta/man/translate/figs-doublet]])