Did Mary write a Gospel?

No, Mary did not write a Gospel, or anything else that we know of.

There is a text that is known as the Gospel of Mary, but the Mary in question is Mary Magdalene, not Mary the mother of Jesus. It’s an apocryphal text, meaning that it is written in the style of sacred Scripture but is not considered to be divinely inspired. You can read Joe Paprocki’s answer on the Gospel of Mary here.