How can I get gmail label names into a list? In google sheets or otherwise

In google app script

I’m trying to take the gmail labels and print them in a clean list or line where I can suffix every line to easily make filters in bulk. Like this: labelname1, labelname2, labelname3, etc.
Any help is greatly appreciated

This is as close as ive gotten. Im mainly trying to get it to print to google sheets. But anywhere works, as long as its in correct format.

// Logs all of the names of your labels
function retrieveLabelNames() {
var labels = GmailApp.getUserLabels();
for (var i = 0; i < labels.length; i++) {
Logger.log(labels[i].getName());
}