insert statement in loop