creating directories for output
write output to file
refactoring finding reciprocals