Update keygen.py

Reworked the whole script
Removed file saving since the output can easily be saved by adding " > output_file" to the command