This is the 3619th most frequent Japanese word.
間違っ
"間違っ" (machigat) means "mistaken" or "wrong."
In this context, '間違った' is used as an adjective meaning 'wrong,' describing the train the speaker mistakenly boarded.
私は間違った電車に乗ってしまいました。
I got on the wrong train.
Here, '間違っている' functions as a verb in its '-ている' form, meaning 'to be mistaken,' and explains that the number is incorrect.
彼はその数値が間違っていることに気付きました。
He noticed that the number was incorrect.
The usage of '間違って書いてしまいました' puts '間違って' as an adverb modifying the verb '書いて,' expressing the manner of action as being incorrect.