I read once that a marriage like that, in the mosque, without writing but with witnesses, is considered legal. islamically speaking.
however, it's always recommended that you have some kind of proof of your marriage (writing in court, that is) in case there might be problems later. like a divorce.
also when you are married and your child in born, administrative things are much more easy if your marriage is subscribed legally. that is, in the court.
I will try to find back the fatwa where I read this, inshallah.