added a check to create the basepath and check the write permission in the basepath for FileOutput
move checkWritePermission to the main output.go file