using heredoc to write to file