code: func ExportAppendChain(blockchain *core.BlockChain, fn string, first uint64, last uint64) error {
  	log.Info("Exporting blockchain", "file", fn)
  
  	// Open the file handle and potentially wrap with a gzip stream
  	fh, err := os.OpenFile(fn, os.O_CREATE|os.O_APPEND|os.O_WRONLY, os.ModePerm)
  	if err != nil {
  		return err
  	}
  	defer fh.Close()
  
  	var writer io.Writer = fh
  	if strings.HasSuffix(fn, ".gz") {
  		writer = gzip.NewWriter(writer)
  		defer writer.(*gzip.Writer).Close()
  	}
  	// Iterate over the blocks and export them
  	if err := blockchain.ExportN(writer, first, last); err != nil {
  		return err
  	}
  	log.Info("Exported blockchain to", "file", fn)
  	return nil
  }
docs: // ExportAppendChain exports a blockchain into the specified file, appending to
  // the file if data already exists in it.