Having your ERP system (a web application) generating source code for Visual Studio sounds like a strange idea to me.
Wouldn't the right approach be creating a Visual Studio add-in and using the existing API to create a table instead of generating the file all by yourself? I see that IMetaModelService (in Microsoft.Dynamics.AX.MetaData.dll) has a method called CreateTable().