There are a number of factors you need to take into account when choosing which language to use when writing a particular program or script that you need.
One of the main factors is which languages if any that you already know. If you already know a language tat can be used to create what you require even if it isn't the best language from the viewpoint of the way the code needs to be written then it might be the best choice for you because it means that you don't need to spend the time learning a new language. If you do have the time to learn a new language and there is one that would make this particular tas significantly easier then it may be worth the time learning that language rather than usung the one that you already know. Generally though you will be better off choosing a language you know to use to write your new code though provided that the language can do what needs to be done as it is alwats quicker and easier to write in a language you are more familiar with than in one you just learnt.
If you don't already know any languages then you are going to need to learn one before you can write your program or script (asuming you are going to write it yourself rather than get someone else to write it for you). Here the choice of which language to learn is much more dependent on which is the best language to use to achieve your desired outcome since there are no languages you already know to affect your decision.
Being suitable for the particular task isn't the only factor you need to consider in selecting a new language to learn though. This will not be the only code you will write and so what other code you are likely to want to write in the future is also going to be a factor unless you intend learning additional languages every time you need some new code. Selecting a language that will provide greater flexibility for the future is perhaps a better chloice than a less flexible language that might be ideal for the current code but which is unlikely to be useful afterwards.
So there are a number of factors to weigh up when deciding what language to learn/use. There is what you already know, what can do the job, what else the language can do, what else you are likely to want to do, how willing you are to learn additional languages, and many other possible factors. Only you will be able to take all these factors into account for your given situation so as to decide what language. The unfortunate thing is that the fewer languages you already know and the less experience of writing code that you already have, the less likely you are to either know the answers to many of the questions raised in determining the appropriate outcome but also the less likely you are to even consider all of the things you need to in making your choice and therefore the more likely that a less than optimal choice will be made. Hopefully though since you have actually read what I have to say here you at least have a starting point so as to begin searching for the appropriate questions that you need to ask in order to make the right choice.