Hi vishal bhatt,
i would guess the bug is in your programm, because you cant do much wrong defining your window. Just look that it is same type as window 5 - should be "VAR" in your case. --> you can set window as variable or const.
Const means, window is constant and content is the same for every page.
variable means content can vary for each page.
i think you have set the window type as needed, because you have differnent content (just not always)
So i think the mistake is inside your loop logic, if the variables (used in your window) gets new value befor "write-form" or not.
regards
Stefan Seeburger