Storing hat/effects data in one single line line

I want to store hat/effects names in one line of data, and, after player joins, it prints using the print() thing every single one. The line with all hats/effects should look like this:

“blue trail,owner tag, rainbow halo, blue halo”


can you specify? i did not understand.