"Statements are not allowed at the top level" occurs because you put the code into a file but didn't wrap it in a func.
The line
if let banjo = URL(string: ...
etc
is a statement, not a declaration. Swift wants you to be clear about when that statement should be executed. You can sprinkle declarations around your program more or less wherever you like, because (generally) a declaration just makes a thing exist as a named object in your program, and doesn't have side effects which may differ depending on order of instantiation.
There is built-in documentation in Xcode. Window / Developer Documentation. Type URL into the search field, choose Swift as the language. You can also search on https://developer.apple.com/documentation/ . Click on the magnifying glass icon.
The documentation for URL is surprisingly difficult to find on the web site, but it is here:
https://developer.apple.com/documentation/foundation/url
There is some more comprehensive documentation about using URLSession to download files here:
https://developer.apple.com/documentation/foundation/downloading-files-from-websites
To your question about the "shared task" - there isn't a shared task. What is shared is the URLSession. Read the documentation for URLSession.
https://developer.apple.com/documentation/foundation/urlsession/
URLSession.shared returns a URLSession. You're making a request to the URLSession (a class, which is a collection of functions) to get its shared instance, which is a single URLSession object (a class instance, which is a collection of functions and state).
https://developer.apple.com/documentation/foundation/urlsession/shared
"For basic requests, the URLSession class provides a shared singleton session object that gives you a reasonable default behavior for creating tasks. Use the shared session to fetch the contents of a URL to memory with just a few lines of code."
From that single URLSession object you are creating a dataTask with a URL called "banjo".
https://developer.apple.com/documentation/foundation/urlsession/datatask(with:)-10dy7
The dataTask "Creates a task that retrieves the contents of the specified URL."
But that task won't do anything until you tell it to, by calling resume() on it.
Please, when you post code, wrap it in a code block, using the Code Block widget under the Reply box on this forum. Otherwise your code is difficult to read.
You can post up to 7000 characters in a reply - it is easier for us to help you if you post a complete code snippet.