So, the statement "Loogies are the same thing as phlegm" is already grammatically correct. You don't need to change the spelling.
However, "Loogies" is a very informal word, and it's best to use "phlegm" in most situations, especially in formal writing.