'DeprecationWarning: QgsVectorFileWriter.writeAsVectorFormat() is deprecated'
'DeprecationWarning: QgsVectorFileWriter.writeAsVectorFormat() is deprecated'
is a warning, not an error.
If you check the the documentationdocumentation for that method you see that using QgsVectorFileWriter.writeAsVectorFormatV3()
is recommended instead.
Once you adjust your code to use that method, the "error""error" will disappear.