Correctly add new line after grouped output