Your bot can be mocked and output incorrect results.
You're advised to include the -n switch for the writeini command.
Your snippet reminds me of a socket script I made that connects to chacha search service, which they provide commonly asked questions at: http://www.chacha.com/
ChaCha is a search engine which specializes in a question answering service that uses a technique known as the human search engine.