I don't know how hard this would be to do in Python - appending text to a file is straightforward, but it sounds like you'd need to extend the browser itself to get the functionality you want. The most obvious choice if you want an extensible browser is Mozilla Firefox (http://www.mozilla.org/products/firefox/), but AFAIK its extensions are written in C++, and I'm not sure how easy it would be to get Python into the mix.
If you do get this working, I'd love to hear about it! I've wanted this feature in browers for a long time. -- http://mail.python.org/mailman/listinfo/python-list