How does the internet play a role in data sharing?

Depends.

If you are on an internal network, it does not.

If you are sending data out to another network, then the data will go through the public internet infrastructure.

If you want a more details answer, read the school books you should have been instead of posting the question here.