For writing to the script you need to program your own code.
you can indicate in your file a section which will be changed by the program, by using the comment tags "--".
e.g:
-- SETTINGS MANAGED BY DBPRO
screen_width = 1024
screen_height = 768
screen_depth = 32
-- END OF SETTINGS
Now you need dbpro code to write the settings to the file, use the file commands to achieve this.
e.g iterate through the lines of the file by using "read string" or the like, to read a line of a file. check if the line is "-- SETTINGS MANAGED BY DBPRO". If yes, then all the lines following until "-- END OF SETTINGS" are be changeable.
search for the apropriate line where the first word is the variable you want to change, e.g "screen_width".
now overwriting is not that easy I think, as you will have to move all following bytes accordingly. There is no insert line command, so you might have to write code simply to copy the rest of the file after the new line you inserted.
However, think of what you want in the first place. A script enables you to change settings without having to recompile a program, or to make your program customizable by the user.
If your program allows the change of these settings at run-time, then there is no need to use a scriptfile for this anymore!
You simply store the user-settings as you would without lua in a config file, which is not meant for manual edit.
For those settings, for which you do not provide a settings menu in the program, you still can use lua script files.
If you still want to overwrite the script file, I hope the approach described above is helpful.
PS; in case you miss me next week: I will be on holidays!