Since comments suck for formatting, please verify this is the correct input/output format desired:
In this case your output file with ALL groups is still only ONE line, not multiple lines. This would also mean that ANY spaces in lines in your groups of lines would look indistinguishable from a 'new group' in the output file. If this is not your desired format PLEASE provide a sample input and ouput in your question description.
Per your description, here is a script which will create your file. Please make sure to modify the 'open('filename.txt', 'r')' with the correct filename.
newfile = open('newfile.txt', 'w+')
with open('filename.txt', 'r') as f:
group = ""
for line in f:
if len(line) > 0:
group += line + " "
group = group + "\n"
Per @MohsenEl-Tahawy here is his perl solution:
perl -00ne 's/\n/ /g;print "$_\n";' inputfile