Hello,
it is also possible to connect locally and save scan output to file. Like this:
/system ssh address=127.0.0.1 port=22 command="/in wi scan wlan1 duration=8s" output-to-file=scan.txt
With ssh-keys it should connect without asking for password.