Implemented writing GRM result to output file