Using the if statement with the Serial monitor

Issue with = instead of == in your if testif (myname="Max") // oops

You don’t need the last while since the loop will loop so you’ll go back to the top where you are actively waiting for input

You should read this Serial Input Basics and Planning and Implementing a Program

And of course you should read how to use the forum...

Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)