code: def _write(self, session, openFile, replaceParamFile):
          
          # Write lines
          openFile.write('GRIDSTREAMFILE\n')
          openFile.write('STREAMCELLS %s\n' % self.streamCells)
  
          for cell in self.gridStreamCells:
              openFile.write('CELLIJ    %s  %s\n' % (cell.cellI, cell.cellJ))
              openFile.write('NUMNODES  %s\n' % cell.numNodes)
  
              for node in cell.gridStreamNodes:
                  openFile.write('LINKNODE  %s  %s  %.6f\n' % (
                      node.linkNumber,
                      node.nodeNumber,
                      node.nodePercentGrid))
docs: Grid Stream File Write to File Method