Please become accustomed to provide decent context info of your problem.
It is always helpful to carefully and detailedly phrase a request, and to support it with system info like OS and shell, related environment (variables, options), preferred tools, adequate (representative) sample input and desired output data and the logics connecting the two including your own attempts at a solution, and, if existent, system (error) messages verbatim, to avoid ambiguities and keep people from guessing.
Some comments to your above snippet:
the fi is missing
variable $fname is undefined
there's only BEGIN and END sections in the awk snippet; no input is processed. Inserting a }{ before the print "<tr>" might bring you closer.