generating while statement