How to Loop with the final result formatted differently?

I’m not sure of the context for this, but query_posts probably isn’t what you want to use. (See this answer).

(Untested). I would use get_posts:

$posts = get_posts(array(
  'numberposts'=>-1,
  'category'=>0
 ));

And then use wp_list_pluck to get the titles:

$post_titles = wp_list_pluck($posts,'post_title');
$post_titles = array_map('esc_html',$post_titles);

Finally, the php implode function an list them with commas:

echo '"'.implode('","',$post_titles).'"';