The $loop() only defines which data is to be sorted but not which data is to be exported.
So you would have to add a statement that actually outputs the track number, e.g.
$loop(%track%) $num(track%,2). %title% %_length%
$loopend()
for a table-like output it may be necessary to add a character like $char(9) (the tabulator character)