Is it possible to add trees to the terrain by scripting?
You can indeed, but it's through the highly undocumented and unsupported TerrainData class
You'll want to play around with terrain.terrainData and inside that, treeInstances.
treeInstances is an array of TreeInstance objects, each of which you can set position on
Your best bet is most likely to just start out by cloning a TreeInstance, and changing the position (TreeInstance is a struct, so you can easily clone by assigning another TreeInstance to a new variable)