Do you mean that you are going to migrate SharePoint On-premises to Online?
As you said, it needs to manually add file tab in Private channel. If you want to realize it by scripts, it is more related to development, which we don’t support. You can refer to this article to learn how to add tab to the specific channel within a team.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.