In a book I've learned "(name) to moushimasu" as an introduction, but as japanese has no spaces, would it be written with hiragana as follows or something different?
(name)ともうします。
If your name Zach is written in Japanese as ザック or ザッハ, you would introduce yourself as (1).
(1) ザックともうします。 or ザッハともうします。
Your guess is perfectly correct.
As you know we don't use a space between words, so it is also difficult even for native speakers of Japanese how to parse (1) at first glance.
"と", "も" and "とも" are all possible particles and "もう" could be an adverb in Japanese language.
In a short time, you have to understand that "と" is a particle but "も", "とも" and "もう" do not function as they are, but they are part of another word.
To solve this kind of difficulty, we use kanji if possible. You can rewrite (1) into (2) with using kanji.
(2) ザックと申{もう}します。 or ザッハと申{もう}します。
Now you can understand the meaning of (2) at first glance because you can easily parse the sentence without getting confused by spurious elements such as "も", "とも" and "もう" in (1).
For something as short as "Xともうします" you do not need any spaces. Japanese for adults is almost never written this way, because most Japanese find it clearer to read when the kanji is used: "Xと申します"
The only time I have seen native Japanese written with pure hiragana is in books for very young children (usually first-graders, who don't know any kanji). In these books, the words are typically separated by spaces. This makes comprehension easier when the kanji are missing. The spacing is different from how Japanese is sometimes written in English-language Japanese textbooks. For example, particles are usually attached to the words they follow ("それは おもしろい"), and conjugations that English speakers might interpret as compound verbs usually have no space ("ありませんでした"). I find these books interesting, because they show that while the Japanese do have a sense of word boundaries, it doesn't always match how we think in English.
I have only ever seen spaces in books for very young children. Usually, Japanese text contains no spaces.