FOR LOOP moves to top

when I use FOR LOOP in coding, when I update, it automatically changes location. Pls help, how to use for loop.

Its not clear, please provide details.

https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=for%20loop%20in%20python

https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=for+loop+in+javascript

Sr Description Qty Rate Amount
{{ row.idx }} {{ row.item_code }} - {{ row.description }} {{ row.qty }} {{ row.get_formatted("rate", doc) }} {{ row.get_formatted("amount", doc) }}

Can you please tell me the coding error? Because, if I press update button, FOR Loop will move to top row.