Downloading some sketchy shit off Tor?
By that do you mean an union service?
AVs are only as effective as the people who use them.
Your script can be perfectly fine and still be picked up by an antivirus.
Yea, that's not as likely as you might think.
I'll clarify. There are a few methods an AV system uses to detect potential threats.
Signatures are still used to some extent.
They also use VM systems to run files on and see how they behave to try and detect them.
There is another reason. Some is self extracting in nature and uses methods similar to that of a boot system.
It extracts code into memory then sets the processor instruction pointer to the memory location.
Another method is program signing and signatures.
Google a code signing certificate to learn about it.
That's all generally referring to compiled code.
Scripts such as malicious web pages, python and so on are also handled in multiple ways.
There are a number of things beside malicious code that can set of some AVs and similar tools.
Unsafe script methods is probably the biggest. That's why it is important to keep up with security regarding the language you are using. Don't keep using deprecated crap.
Just because the code runs and does what you want doesn't mean it is safe.
Take for example you don't verify the input coming in isn't larger than the buffer you have created.
Or you don't clean the input of potential malicious code someone else can enter.
Depending on the system and resources made available through such a script it could have different effects.
It could result in something fairly benign like cross sight scripting. Still not great but minor in comparison to having your security wide open or having your entire file system or data-based deleted.
That said some times the issue isn't with your code but the compiler and the way it compiled. I haven't seen that issue in over a decade though. Most of the people working on libraries these days have a pretty good understanding of security and practice methods to prevent such issues.
So if an AV is saying their is something wrong with the program there is a good chance that's the case depending on which AV you are using.