Append ouput in a single line

Hi Guys,
I need to append some data to a new file, but i need to make sure that when i use to >> command again.I dont go to the new line. i append the data on the same line.

Please help regarding the same.

Thanks in advance..!!!

Whether it goes to a new line or not depends entirely on what data was written there last -- did it end in a newline, or not?

See its like

echo "Hello" >> a.txt
echo "UNIX" >> a.txt

cat a.txt
Hello
UNIX

Now i need the data to be appended like this
Hello UNIX.....

I hope you have got my point.

Yep. You get newlines because you're adding newlines -- echo puts them on the end. If you don't want newlines, don't add newlines...

 printf "hello" > file
printf "world" >>file