Recall that unit 6 (by default) is the display. But what is unit 8? Look above the DO loop, and you will see the statement
OPEN(UNIT=8, FILE='filename')
What this says is to use the file 'filename' as unit 8. After this statement is executed, when we write from unit 8 we are writing to the file 'filename'.