re: "If i run the script on multiple devices, how do i get the result in one page?"
That script you posted has annotations indicating it's a local script, to be executed from Junos Space. If you want to be able to repeat the same operation across multiple (selected from the Space UI) devices, AND keep the output in a single stream, then you'd need to modify your script so that it can understand it's going to need to work over a GROUP of devices -- not just one. You do this by adding these annotations:
/* @EXECUTIONTYPE = "GROUPEDEXECUTION" */
/* @PASSDEVICECREDENTIALS = "true" */
Once you've done that, then Space will happily pass the id & credentials for all selected devices. Your script will be resposible for parsing out the selected device ip address, user credentials etc.
Once you have that, then you can just iterate through the list of devices, executing the commands and appending/annotating each device's output until you're done.
If that's something you're up for, I think there are some examples Andy did floating around here -- some of which may have even made it into the online help in Space. (not 100% sure on that second thing.)
/doug