Greetings.
I realize that you want an automated script where you provide a file with a list of keywords, and you want a list of corresponding urls against each keyword. I'm planning to do it with python. So, you have to have python installed in your system. If, for some reason you can not install python, do let me know and I'll switch to Java.
Besides that, I understand most of what you're requiring, but have some questions about the constraints, and limits. Like, the different APIs you're willing to use, and how many urls you need against every searched keyword, and how many expected keywords will be in the textfile.