I don’t see anything wrong with this except that a shortcode should return the value, not output it
// somewhere at the top of your shourtcode function
ob_start();
return ob_get_clean();
// at the bottom or your shortcode function
The only reason that it is returning no posts is that it has found no posts. This means that:
- the meta key you are searching on is wrong
- the attachment post does not have a value in this meta key
- there are no attachement posts with this meta value