set myFile to choose file with prompt "Select an XML file" This will work with multiple lines: set myText to {"one:two:three:four:five:"} set the end of myText to return & "abc:def:" set the end of myText to return & "ghi:jkl:" set the end of myText to return & "mno:pqr:" set the end of myText to return & "stw:xyz:" & return set AppleScript's text item delimiters to {""} set myText to myText as text -- myText is 6 lines of text set xmlString to (read myFile) set xmlString to (read myFile) set AppleScript's text item delimiters to {return} set myText to every text item of myText set AppleScript's text item delimiters to {xmlString & return} set newText to myText as string