Well, the Kindle previewer is using kindlegen to convert the epub to mobi format, so kindlegen would appear to be working on your computer (a Mac, perhaps? you didn't say.) But as you have seen, kindlegen will not produce an inline TOC.
Calibre will generate an inline TOC. I don't know why you're having the line-break problems, though. With default settings, Calibre usually does a very good job converting epub to mobi. Did you change any conversion settings? Does the epub make heavy use of tables, or some other complicated formatting? Does Pages produce a standards-compliant epub, or is it more of an iBooks-compliant "epub"?
By the way, kindlegen is a command-line program and must be run from a terminal. If you're on a Mac, this may seem somewhat... exotic.