Thanks for reaching out on Microsoft Q&A!
Your plan of attack seems correct, however I do believe that the place where you're replacing the text is where it is going wrong. I think you should already remove the new line feed in the JSON, and push that to the CSV as input, kinda like this:
json(replace(string(body('YOUR_JSON_ACTION')),variables('``var_newLine``'),','))
Please click ‘Accept answer’ if you think my answer is helpful. Feel free to drop additional queries in the comments below!
Kind regards,
Sonny