Animation with cloth modifier renders as a static element
Select your flag object and fix the modifiers order by moving the cloth modifier to the top. Then you go to the Physics tab, press "Free All Bakes" and "Bake All Dynamics" (at Cloth Cache section). After the baking finishes you should be able to render the animation.

From Blender documentation (emphasis mine):


  Once the object is designated as Cloth, a Cloth modifier will be added
  to the object’s modifier stack automatically. As a modifier then, it
  can interact with other modifiers, such as Armature and Smooth. In
  these cases, the ultimate shape of the mesh is computed in accordance
  with the order of the modifier stack. For example, you should smooth
  the cloth after the modifier computes the shape of the cloth.