Modify write file method

1. Merge write_file between Page and Index Generator
2. Move it to cli.py
Remove all double-underlines in class methods
Adjust PagegGenerator class method sequence