You saved the file with incorrect line-endings (carriage return instead of newline characters) therefore it looks like one line to unix. You need to save /etc files with newline line endings (unix) To do so you could use a good plaintext editor like TextWrangler. Alternatively you could use this command in Terminal:
sudo perl -pi -e's/\015/\012/g' /etc/hosts