The first on text event/write is missing the filename on the /write command
On the second event, you have a dot at the end of the path in $read()
If you want to increase a counter, you don't need to use a text file for that, use a global variable:
on *:text:!dc &:#: {
;the & above makes sure $2 (the second word) is filled
inc %death
msg # Death Count: %death
}