write/overwrite results each iteration