This is a very common question for any programming language, and the answer is surprisingly simple.
Do what makes sense and makes the program better.
Here are qualities that make a program/script better in no particular order:
- Ease of understanding
- Ease of maintenance
- Ease of extension
- Ability to be tested and debugged
- Portability
- Performance
If separating the code into multiple files increases any of these metrics without sacrificing the others, then you should do it. If it does not, then you should avoid it.
It is sometimes difficult to determine if these metrics are being positively affected. Furthermore many of these qualities can be subjective. To get a better perspective on your code I would encourage you to submit the code for review by your peers and senior developers in said area. Code review is one of the best tools programmers have to hone their ability to discern the above qualities.