How to convert multiline string to single line string

My file contains data in multiple line with some space. I want to convert this file data into single line string
how can i do this?

Hi Shubham,

Kindly confirm is it text file or other file.

I am extracting pan card using OCR and storing result into outfield variable.
As when I write this field into text file,it stores into multiple line