Fetching details from the dictionary...

to struggle; to writhe; to wriggle; to squirm
to act frantically; to make desperate efforts
彼は多額の借金の中でもがいている。
He's struggling in a lot of debt.
もがいても抜け出せない状況だった。
It was a situation I couldn't escape from no matter how I struggled.
苦境の中でもがきながら、少しずつ前へ進んでいる。
Struggling through hardship, I'm moving forward little by little.