The carbon (in coke) burns to form carbon dioxide
carbon + oxygen → carbon dioxide
C(s) + O2(g) → CO2(g)
Carbon dioxide reacts with more carbon to form carbon monoxide.
carbon dioxide + carbon → carbon monoxide
CO(g) + C(s) → 2CO(g)
The carbon monoxide is the reducing agent which reduces iron(III) oxide to iron.