Created the function that builds the html and appends it into page.