1. Use a file to write data in and read in other instances (Same machine)
2. Use Sockets
3. Create a Rest application
Some will be harder than others ^^
Logging in is a client behaviour, not script behaviour
If you are using a jagex account make sure you are using the latest developement client to log back in