Fix newline characters when running on windows

use os library to use \n for mac/linux environments or \r\n for windows
environments