Golang read and write same file. NewScanner creates a scanner to read the file line by line.