proper sudo file append handling