How can I store text or string from any search engine while searching to a text file which is local?
Have you considered using a keylogger?
There are 2 libraries I know of that can help with this: msvcrt and pynput. They are used to get user keyboard input. You can write to a text file after every keystroke.
Does that answer your question?