Create directory if it doesn't exist for single.py

Along with that, fix some minor newline issues.