The injured writhed in agony from the pain.

Literal

Injured-person [topic-は] pain [with-で] writhing suffered.

もだえ苦しむ is a compound verb — もだえる (to writhe) + 苦しむ (to suffer). で marks the pain as the cause. Vivid and literary.