Nested directory should be created if specified in output to task

Updated output task to create nested directories when they do not exist, making the task behave consistently for file, erb and directories.