He wrote down the man's name 8 times, the first of which was correct. The next 7 attempts were other guesses at the spelling of Takuo.
There is, however, a rule in the death note stating that if a person intentionally writes a name incorrectly four times, that person will die.
However, just like in "Death Note Onison", the intent to misspell is a key factor. In "Onison," L has Misa write his and his companions name's down four times. They do not die, however, because L knew Misa was illiterate, (at least in this version of Death Note) and she tried her best to spell the names correctly. Because she tried with intent to spell correctly, she did not die; Light Yagami did not die for the exact same reason.
Light Yagami has found the perfect murder weapon, and unknowing almost killed himself in the process of trying it out. Had Takuo's name been written incorrectly over 4 times first by Light, and then one of the next four spelling been correct, Light may have been killed first, then Takuo. Light would die since he got the spelling wrong 4 times in a row before getting it right. Takuo would die because Light still got it right once, and a name written in a Death Note can never be prevented.
Even though I have already stated that intent is required for the Death Note to be effective, evidence is only seen for this in "Onison," which was only a skit, and the word "intent" in the rule on the Death Note page describing that the person would die if it was written incorrectly four times.
Even though Light did truely intend to spell it correctly, he did know he would potentially misspell it as well. As we see in the Manga and the Series, the rules of the Death Note can be somewhat loose. If you figure out a particular rule by testing it, you can utilize it how Light did. However, we never see somebody incorrecly spell a name 4 times in a row to see what would happen to them, since Light got his very first guess right.
The truth is, nobody knows what would have happened had Light been wrong more than 4 times before getting it right, since we never see what the Death Note would do in a situation like that. How the Shinigami killings occur is a very interesting speculation, but impossible to comprehend.
Luckily Light did not intend to misspell the names, and he also spelled the very first one correct. This means that one of these factors prevented Light from dying, and continuing to utilize the power of the Death Note. Unlocking this secret could have cost Light his life, (if that sounds melodramatic, an early death) but his spelling abilities allowed him to almost rule the entire world.
Boy handed death note and bored Shinigami encounter.
Boy: "What's that?"
Shinigami: "It's a Death Note. You just write a person you know's name in it."
Boy: "I can't spell yet."
Shinigami: "That's fine." smirks
Note: The previous skit at the end is based on the assumption that the result of writing a name 4 times consecutively with the intent of being correct will not prevent the death of the Death Note user. However, this is not proven in the series and is merely speciation at this point.
Credit: The line, "If that sounds melodramatic, an early death" is taken from the light novel "L Change The World," which features an alternative ending that L defeats Light.