iteratively writing results