The macro \hrulefill tells TeX to fill with a rule the available space, but in your case there's none: \underline{...} creates a box as wide as the text inside.
What you probably want is "HOMEWORK" on a line by itself followed by a horizontal rule across the whole page. Then
\par\hbox{HOMEWORK\strut}\hrule
should do what you need.
If you think that the spacing is excessive, don't. :) Underlining is frowned upon in typography. However, you can play with spacing by trying
\par\hbox{\scshape homework}\kern1pt\hrule\kern3pt
giving different values until you're satisfied.