How to create a module based on files such as user data files

I’m trying to build modules, but I don’t understand how to create a module that points to on disk files such as user data scripts, what is the way to work around it? I know for user data script I can use the <<-EOF but that is not good enough when the script is very long.
I would like to be able to call the module without providing it the file itself.

any suggestions?