In these verses the word "her" refers to the city of Babylon.
# committed sexual immorality and went out of control with her
"sinned sexually and did whatever they wanted just as the people of Babylon did"
# afraid of her torment
The abstract noun "torment" can be translated as a verb. AT: "afraid that they will be tormented as Babylon is" or "afraid that God will torment them as he torments Babylon" (See: [[rc://en/ta/man/translate/figs-abstractnouns]])