Hi
You can use querySelectorAll method to add the print button to all div at a time
eg:
var divs = document.querySelectorAll('div');
[].forEach.call(divs, function(div) {
// code to add print button for each div here
});
Reference
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll