That spring is used to press the idler (that round thing on the left in the red part) against the part that's being turned by the extruder. This is required to get enough pressure on your filament so the extruder motor can pull or push it through. Without that spring there would be no pressure and your extruder would just spin on the filament.