How to update a text file dynamically

I want my server to be always connected

Is the Arduino the server? Or, is it a client? Why are you trying to defeat the normal client/server relationship (which does not involve a persistent connection)?