We bought 18" by 24" flags
from the US Flag Company. They come on a stick that you can remove and try to find a use for. We thread some line through the sleeve where the stick goes. Flags are $2.50 or so each, cheaper if you get more than one. Each will last for 4 to 6 weeks in trade wind
conditions - longer if you keep an eye out for wear and tear. They certainly cannot get all the countries, but you can jury rig. We bought some extra Red Ensigns and added modified them as needed. Hardest one to make was Cook Islands
since we had to cut out so many white stars and sew them on. Ask your sailmaker
for some ripstop scraps. You want red, green, white, dark blue, black, and yellow.
Not sure about the idea of buying
them when you get there. We entered in a lot of places that did not have markets that would have flags. BTW, get one of the expensive, well-made French flags. You will use it. You don't fly the flag when you enter, but shortly after when you have cleared in. Make yourself a big Quarantine (yellow) flag to fly as you enter.