Update SearchCmd.java

changed the if else while statement