How to display dialog box to save file from wp_filesystem->put_contents function?

… instead of saving the file on the server I would like to display
browser dialog box to save the file with this content on local disk

The answer is that that is not what the Filesystem API does. You are trying to, or hoping to, use it incorrectly. It doesn’t work that way. The Filesystem API saves to the server filesystem, not to the client disk. The server does not have that kind of control over the browser or the client machine, and for good reason.

What you will need to do is “ask” the browser to download– something like this: https://stackoverflow.com/questions/8800714/how-to-show-the-save-dialog-using-html

tech