\documentclass{article}
\begin{document}
This is the main document.
Below we include the middle file:

This is the middle file.
Below is the inner content:

This is the innermost content.
It should appear nested within the final document.

End of middle file.

End of main document.
\end{document} 