You have data stored (usually in a file) on your device.
You share it with your printer, Google Drive, something.
Depending on what it's shared with, it's stored or not stored there in different ways. (For example, if you share something with your printer, it's "stored" onn a piece of paper that comes out of the printer.)
It's still on your device in whatever format it was before you shared it.
If you share something that's not stored, it's not stored. (Open a text editor, type some text, share the text, close the editor without saving, and nothing gets saved on your device.)
If you're sharing data from one app to another, it's the same thing. Printing is sharing printable content with a printing app. Sharing a picture you get in one app with another app that can "get" pictures is the same thing. If the app sharing the data, or the app having the data shared with it saves it, it's saved where that app saves data. If not, it's not saved.
(During the actual sharing, the data is in RAM, but that's not something you can write an app to do anything with - one app can't access another app's data. It's by the sharing mechanism in Android that we get one app to share its data with another app.)