Code:
alias wrong {
  write test.txt a
  write test.txt b
  write test.txt c
  set %d 2
  write -d%d test.txt
  run test.txt
}

Will give you:
a
b

which is wrong, it should give you:
a
c

which mine does. Yours always deletes the last line, that isn't what he wants.