1. There is no such thing as a font tag - there used to be but it was deleted from HTML in 1997. You should replace it with a span tag and attach CSS instead.
2. You can't use numbers by themselves after a # in the href as the value after the # points to an id in the page and ids must start with a letter.
3. To generate the code in a while loop you'd need to run the loop using PHP. As you have a fixed number of entries you want for each difection a for loop would work better than a while loop. See
http://php.net/manual/en/control-structures.for.php