If you need to import the external data as tracked entity instances within a program, it means that you need to transform your data to json payload by specifying the tracked entity_id, the orgunit and for each data values theirs corresponding attribute_id. Then you can upload the created json file via the app “import-Export” or use CLI.
This transformation of csv file for exemple to json payload file can be done by writing a small app (in nodejs,php,…) that will do the job for you. And you may see some project on github that could help.