I can see that in put_off_fire() you sweep the servo to 130 then back to 50. But you only call that function if the flame is in front not if it is left or right. What's the point of that?
Also you print "Flame on front" when there is no flame as well as when there is a flame in front. Why?
If you want help you need to say exactly what that code does now and exactly what you expect it to do...in detail.
Steve