At the end of every <td>, there should be a </td>, and after every four sections, add a </tr> and delete the new table setting. Every four lines doesn't have to be a new table; that's what's putting the extra spacing in.
is how I fixed that issue, and then add your </table> tag at the very end after all your lines.
(Also, I realize this question is from last year, but I figured you might not be the only person with that question, since I wanted to know too, so I figured I'd answer it here so it'd be here.)