Problems with endfloat package

Not sure it's documented (didn't look:-) but due to the way the package scans for the environment

\end{table}

needs to be on its own at the start of the line so delete the spaces before it in your example.


This is documented in the endfloat manual

10.1 Literal strings

When floats are being read, LATEX is in verbatim mode. Among other things, this means that the lines like

\end{figure}

must appear on lines by themselves without any whitespace before or after them. A complete reimplementation of the most difficult part of the package is required to fix this limitation, but it is among the distant goals I have.