Here is the user of the Xcode script, which should not destroy new lines in the text.
tabChar = '\t'
input = '''%%%{PBXSelectedText}%%%'''
print "{"
for line in input.splitlines():
print tabChar + line
print "}"
script Input Variables Xcode Workspace Guide %%%{PBXSelectedText}%%% .
EDIT: ββ , . . , , Xcode, .