displaying the categories post

That happens because the_content() contains already an echo. PHP tries to create the string before it sends it to the echo command. While the string is evaluated the content will be printed already. Then echo gets what was not yet printed: the li tags.

So the simple fix is:

echo '<li>';
the_content();
echo '</li>';