generate html from template and populate data into