Is it permissible for me to use this talent (writing) even though I acquired it in a way that is not permissible, as I believe, to earn money and write books, especially since I do not know who they (the neighbours) are? Is there any way out from this by giving charity on their behalf and so on?
May Allaah reward you with good.
Praise be to Allaah.
We have previously spoken about the ruling on using someone else's Internet connection. Please see the answer to question number 99544.
If we assume that your using this Internet connection affected its speed and harmed your neighbour, then this is a sin that you must ask forgiveness for. But it does not mean that you cannot make use of talents in writing or benefit from them, whether it is said that you had this talent before or you acquired it by using the Internet -- which is unlikely -- but if you give something in charity on behalf of the people whose rights you transgressed against, that is something good in sha Allaah.
We do not advise you to use that talent in writing that you have discovered in the Internet, because this is something that may not have good consequences, because there is a lot of nonsense on the Internet, the traps of the shaytaan are widespread in it and his tricks are hidden. Strive to write essays or books that will be of benefit to you and your brothers, focus more on calling people to Allaah, enjoining what is good and forbidding what is evil, and teaching useful books to your sisters and the people around you. Let your focus in writing be that which is of benefit and which brings you closer to Allaah, and you will be happy when you see it in the record of your good deeds on the Day of Resurrection.
We ask Allaah to bless and guide us and you.
And Allaah knows best.