Here the verb "wrang" is used in the past tense as Ennis admits that he had jerked off, or masturbated many times. The adverb "out" serves to intensify the strong emotions of longing experienced while thinking about the friend he had not seen nor touched for four years.
"I never had no thoughts a doin it with another guy except I sure wrang it out a hunderd times thinkin about you." This is from the written novel Brokeback Mountain by Annie Proulx
Get the I sure wrang it out mug.