You can do this with sed, but you may have to know how many newline chars there are. For example:
$ T1="this \nis a \ntest"
$ echo $T1 | sed '{
N
N
s/\n//g
s/ //g
}'
produces: thisisatest
The sed script says: cancatenate the next two lines (the N's), then replace newlines with nothing, then replace spaces with nothing.