To enlarge slightly on Stefan’s reply, the compiler can’t see here that ‘current tab’ is supposed to be a Safari term, because ‘app_name’ won’t be set until the script’s actually run. In the version which does compile, the fact that ‘current tab’ is a Safari term is explicit in the code.
To give Neophyte an answer on how his script would look like:
set app_name to "Safari"
using terms from application "Safari"
tell application app_name
set video_URL to URL of current tab of first window
end tell
end using terms from