assuming that your code do what it suppose to do
It would looks like :
static void Main(string[] args)
{
while ( wantToReplace() ){
}
}
static bool wantToReplace() {
Console.WriteLine("Do you want to replace another word? \n");
String r = (Console.ReadLine() ?? "").ToLower();
if (r == "y")
return true;
if (r == "n")
return false;
}
note : the comment line indicates that code section that you have