将XML结构写入文件时出错

Currently my console output is formatted like [{a} {b} {c} {d}].

I'm looking to write this output to a file in place of fmt.Println(a), but every time I am met with an error such as:

cannot use a (type []Group) as type []byte in argument to ioutil.WriteFile' or similar
cannot use a (`type []Group`) as type `io.Writer` in argument to `fmt.Fprint`:
[]Group does not implement io.Writer (missing Write method)).

Do I need to convert []group to another type? I have tried json.Marshall(group) but that ended up the same.

package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "encoding/xml"
)

type Bedework struct {
  XMLName xml.Name `xml:"bedework"`
  Groups []Group `xml:"groups>group"`
}

type Group struct {
  Name string `xml:"name"`
}

func main() {
  response, err := http.Get("http://localhost:3000/cal/?noxslt=yes")
  if err != nil {
    fmt.Println("Error opening file:", err)
    return
  } else {
    defer response.Body.Close()

    contents, _ := ioutil.ReadAll(response.Body)

    var b Bedework
    var g []Group
    xml.Unmarshal(contents, &b)
    for _, group := range b.Groups {
        g = append(g, group)
    }
  fmt.Println(g)
  }
}