You wouldn't really need a script for this, you could use the command:
Code:
ping -w SecondsToRun xxx.xxx.xxx.xxx > ./PingResults.txt
Where "SecondsToRun" is how many seconds it should run before it stops and xxx.xxx.xxx.xxx is the target IP, obviously.