Paul Curwen
Giga Sage

The ability to download selected attachments is already provided as a standard platform feature. Not sure why you would want to spend time reinventing this? 

if you need to have some custom functionality have a look at this for a good example: 

https://servicenowguru.com/scripting/download-attachments-zip-file/

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul