..The 3D Flag plug-in is a completely physics-based cloth simulation, so you can't set exact start/stop keyframes. However, wind in this simulation is very very smooth, it doesn't suddenly dip or turn unless you tell it to. So if you set the wind speed to be constant the flag will fall into a rhythm. You can then render out a few seconds of the animation and find a decent looping point to do a crossfade and, viola!, you have a looping segment of video.
Here it is in steps. . .
1- Set up the flag.
2- Set the wind speed to 11.
3- Set Pre-roll to 8 (you want to make sure the flag is well into the simulation before you start to render)
4- Render out 10 seconds of animation.
5- Take the clip into an editing program.
6- Duplicate it and make the top layer partially transparent.
7- Slide the bottom copy back and forth in time, until you match up the wave patterns.
8- Set the transparency back to normal.
9- Do a short dissolve from one copy to the other at the match point. ("short" means something like half a second)
10- Render out the looping section of flag.