Your problem description is not very clear.
Now, i need to display the already created .html file on a webpage
What does that mean? Do you need to redirect the user to your xyz.html page or do you need to fill out a web form with the data in your xyz.html file?
Below is a script which doesn't work as per the above requirements.
The only "requirement" you mentioned was display your html file "on a webpage".
In what way does your script not produce your desired results?
The first recommendation I will make is for you to add these 2 statements near the top of the script and fix the problems that they point out.
You also need to fix your code indentation.
If you need to automate webpage navigation, then it might be easier/better to use a higher level module which handles the gory details.
is what is normally used for this purpose. Unfortunately, I have not yet used it myself so I can't give too much help in that area.
Can you post a short but complete script that demonstrates your problem?