Looping, or better known as Grouping, is possible. What tool are you using to build your template? For the BI Publisher Microsoft Word plug-in, this is fairly easy to do. If you need to create an XSL-FO template, then you're going to find things become more complex. I just recently attempted to create an XSL-FO template using third party tools to allow me to group data. The problem is that, as of now with PDF printing via ORDS 2.0.6 (or less), only XSLT version 1.0 is supported. Grouping can be done in 1.0, using various hand-coding methods such as the Meunchian Method, but the actual <current-group> syntax is not supported in 1.0. I'm not that good at hand-coding XSL-FO, so I had to abandon my report project. XSLT 2.0, and the tools that help you to create XSL in that version, make grouping a relatively easy affair.
The APIs (APEX_UTIL.GET_PRINT_DOCUMENT()/DOWNLOAD_PRINT_DOCUMENT()) are missing a necessary 5th signature that would make this very easy... (takes in XML/CLOB for data and Report Name for layout.)
You'll need to use the signature that takes in XML/CLOB for the data and XML/CLOB for the Layout.
Be aware, the Listener/ORDS doesn't like a particulate UTF8 character in the layout - i forgot what it was but you can see it in the Log files of the app server.
Also, check this form for that problem.