How can I modify my Python code to write a dictionary to a file without errors

welcome to shbcf.ru