There are few things in this design which would make me to reject this solution completely:
1. Use of xp_cmdshell
2. Writing file out on SQL Server (or mapped dirve)
3. Use of permanent table - until adding complexity, it has a risk of reporting crap if for some reason this process runs silmulteniously from mulitple sessions.
I would stop this proc with populating #Results table and selecting * (or whatever required) from it.
The caller process should be made responsible for persisting the results.