You cannot force anything to be written into a different program.
However, some other programs give tools that permit other programs to trigger actions. For example on Windows it is not uncommon for programs to provide ActiveX controls.
If a program does not provide any tools, but the program can import what is needed if the user were to take some actions typing and clicking in the program, then you can typically "remote control" the program using Java Robot class from MATLAB. This can be a nuisance, though, as you have to know exact screen coordinates to move the mouse to in order to issue the clicks. Java Robot class has no ability to say (for example) "Move to the File menu and click there": it only has the ability to say (for example) "Move to X = 102, Y = 83 and click there".