What are Packages and their relationship to Assets

Packages are just containers for assets. In code, package is the Outer of an asset.

In UE4/5 most packages types contain only one asset, which has the same name as the package. For example a Texture2D uasset package contains just one Texture2D object with the same name.
package path : /Game/Textures/T_Foo.uasset
asset name : T_Foo
fully qualified asset path : /Game/Textures/T_Foo.T_Foo

One exception is blueprint packages, where the “main” asset is the Blueprint itself (the thing you edit in editor), but its package also contains the generated class and CDO with slightly different names.

In case of datatables I think they are single-asset packages, so it should be pretty easy to handle. Create a package with CreatePackage, and use that as the Outer of the new asset you create. Then call SavePackage and it should do.

See this for more extensive info