well as you would expect, you need to program it in exactly the same way as you would if you were writing pure html:
so lets kick things off with the <img> tag, and add a source to it as one would expect:
<img src="thisfile.jpg">
Let's also make use of <td> as a cell tag, and not use <tr> which is a row definition.
So in total we have:
echo "<table>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<img src=\"$pic\">";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";