dovresti utilizzare un linguaggio lato server poichè con javascript o con l'html non è possibile editare il file ma solo visualizzarlo