write battery levet to a file