Hi,
I don't have an example to hand, but one approach to this would be:
1. Retrieve the config from the device using the appropriate RPC e.g. <get-configuration>
2. Use the <exsl:document> method to write the config to a file and store it locally on the box in /var/tmp
3. Use the RPC <file-copy> to transfer the file to the appropriate location.
Date and Time functions are available in SLAX so they can be leveraged to produce a suitable filename that can be used when creating the file, or transferring the file etc.
You can find documentation on this approach in the Juniper Day One library (https://www.juniper.net/us/en/training/jnbooks/day-one/) which is a great starting place to learn SLAX scripting among other things.
Junos Automation Reference contains examples using get-configuration, as well as numerous examples of <exsl:document> or the other 4 similar functions that pretty much do the same thing.
<redirect:write>, <saxon:output>, <xsl:document> and <xt:document>
The recommendation is to use <xsl:document> as a namespace doesnt need to be defined, but the choice is yours.
Mastering Automation and Applying Junos Automation are also extremely valuable resources, and finally there is a great book Automating Junos Administration available on O'Reilly too (https://www.juniper.net/uk/en/training/jnbooks/oreilly-juniper-library/automating-junos-admin/)
Regards,
Andy