Can you post the code that you were trying to use for underlining...?
Incidentally, "\137" or "_" is a separate character which usually can't be used to to overstrike another character on an xterm or similar window. The usual thing to do on a terminal is to print hyphens on a separate line below the characters to be "underlined". That may be your only option if you want five levels of underlining; most printer escape sequences for underlining can only describe single or double underlining.