List of tracks for each album (CSV)

Hello, I am not an expert with syntax of CSV, I have been reading about it but I cannot reach my objetive.
I want to export a CSV with 1 line=1 album=a list of all its tracks. Because of the csv format limitation I do not know how to add all tracks in 1 same line.
At this time I tried with this, but it print 1 line for each track:

I want to accomplish something like this, noticing that there are 2 different albums with their corresponding metadata in order to export it to another database:

I hope I made myself clear. Thanks in advance.

Make use of the $get and $puts functions.
Exporting Tag and File Information – Mp3tag Documentation

Try this:

$puts(TRACKS,$get(TRACKS)',' %track%. %title% ( %_length% ))$puts(TRACKCOUNT,$add($get(TRACKCOUNT),1))
"%artist%"','"%album%"','"%year%"','"$trim($get(TRACKS),', ')"','"$get(TRACKCOUNT)"

The result has lots of blank lines but these can be removed with Notepad++ or online with Text Mechanic (

Just a question: does it really make sense to get all track titles and the album into one line?
CSV works like a table without the lines. where each column has one specific header.
So if you have further data following the last TITLE then this data will end up in various columns, depending on the number of TITLES. In your example one album had 10, the other one 11 TITLEs.
So the finishing "trackcount" can then be found once in column 11 and the next time in column 12.

To cut things short: you have a classical 1:n relation where n is a real variable that varies.
To get a proper database, you would have to design a record (=one line) with all the data that identifies a single TITLE without hicups. This could be the unique combination of ARTIST, ALBUM, TRACK and TITLE.
Grouping tracks together so that they show up as one album, is a problem of the database front-end.
The export should create a unique data set.

Thank you! Is much more than I could have done! The only problem is that it seems that the database that I am using sets the tracklist as independent lines for each track. But it is not a problem as it is plain text.

I know, that was what I planned at first but when I saw the structure of the database... The app I am using is Memento Database for Android. I wanted to have all media grouped in one single app, but I am facing the problem that with music it only admits the creation of an album catalog, so you can not add tracks 'one by one' to be grouped into album and consequently related to an artist. I do not know how to explain properly, here is what it allows you to do:

So you see that in 'Tracks' it only admits a list of plain text. That's why I needed this request. The solution that provides @ryerman fits perfectly, but it does not separate each track into multiple lines but with a comma.

Thank you all!