strip white spaces and append new line