If you want to sort by album, then discnumber, then track number, you need $loop() statements for each grouping and sorted field.
So probably, it is not really necessary to $loop(%_folderpath%) as you do not need the filename as criterion.The Track List would probably have these statements:
$loop(%artist%%album%)$loop(%discnumber%)Disc %discnumber%
$loop(%track%)$if(%discnumber%,$num(%discnumber%,1)-,)$num(%track%,2) - %artist% - %title%$loopend()$loopend()$loopend()
I think $loop(%artist%%album%)$loop(%discnumber%)Disc %discnumber% $loop(%track%)$if(%discnumber%,$num(%discnumber%,1)-,)$num(%track%,2) - %artist% - %title%$loopend()$loopend()$loopend()
If you think of $loop() as sorting command then it should be fairly straightforward:
First sort by ARTIST and ALBUM, then by DISCNUMBER, there output the Discnumber, then sort by TRACK and output all the required data for that track, here the number, artist and title.
No luck, it does split tracks by Disc number just not in a proper list
Export Output
Track List:
Disc 1
1-01 - Test Artist - 01 Track1-02 - Test Artist - 02 Track1-03 - Test Artist - 03 Track1-04 - Test Artist - 04 Track1-05 - Test Artist - 05 Track1-06 - Test Artist - 06 Track1-07 - Test Artist - 07 Track1-08 - Test Artist - 08 Track1-09 - Test Artist - 09 Track1-10 - Test Artist - 10 Track1-11 - Test Artist - 11 Track1-12 - Test Artist - 12 Track1-13 - Test Artist - 13 Track1-14 - Test Artist - 14 Track1-15 - Test Artist - 15 Track1-16 - Test Artist - 16 Track1-17 - Test Artist - 17 Track1-18 - Test Artist - 18 Track1-19 - Test Artist - 19 Track1-20 - Test Artist - 20 Track1-21 - Test Artist - 21 Track1-22 - Test Artist - 22 Track1-23 - Test Artist - 23 Track1-24 - Test Artist - 24 Track1-25 - Test Artist - 25 Track1-26 - Test Artist - 26 Track1-27 - Test Artist - 27 Track1-28 - Test Artist - 28 Track1-29 - Test Artist - 29 TrackDisc 2
2-30 - Test Artist - 30 Track2-31 - Test Artist - 31 Track2-32 - Test Artist - 32 Track2-33 - Test Artist - 33 Track2-34 - Test Artist - 34 Track2-35 - Test Artist - 35 Track2-36 - Test Artist - 36 Track2-37 - Test Artist - 37 Track2-38 - Test Artist - 38 Track2-39 - Test Artist - 39 Track2-40 - Test Artist - 40 Track2-41 - Test Artist - 41 Track2-42 - Test Artist - 42 Track2-43 - Test Artist - 43 Track2-44 - Test Artist - 44 Track2-45 - Test Artist - 45 Track2-46 - Test Artist - 46 Track2-47 - Test Artist - 47 Track2-48 - Test Artist - 48 Track2-49 - Test Artist - 49 Track2-50 - Test Artist - 50 Track2-51 - Test Artist - 51 Track2-52 - Test Artist - 52 Track2-53 - Test Artist - 53 Track
The stange bit about the export scripts is that the line formatting in the script is also applied to the output.
So experiment a little with added line breaks between the individual statements until the output looks ok.
e.g. $loop(%artist%%album%)$loop(%discnumber%)Disc %discnumber% $loop(%track%)$if(%discnumber%,$num(%discnumber%,1)-,)$num(%track%,2) - %artist% - %title% $loopend()$loopend()$loopend()