For this question i wrote a simple script to show how to create a model and add some inputs and outputs, and add lines for each port to a specified block. this script was run with correct results:
ModelName = 'SpdCtrl';
new_system(ModelName);
open_system(ModelName);
component_dest_name = strcat(ModelName,'/',ModelName);
%% Create and add main block
topsystemblk = add_block('Simulink/Ports & Subsystems/Subsystem',component_dest_name,'position',[165 109 600 700]);
%% Create and add inporting blocks and lines from the dependencies of main component
Horizontal = 165;
Vertical = 150;
N = 200;
M = 165;
width = N - Horizontal;
height = M - Vertical;
vertical_shift = 0;
horizontal_shift = 0;
for i = 1:1:5
vertical_shift = 50*(i-1);
horizontal_shift = 100*(i-1);
inport_dest_name = strcat(component_dest_name,'/',strcat('In',num2str(i)));
inportblk = add_block('Simulink/Ports & Subsystems/In1',inport_dest_name,'position',[Horizontal Vertical+vertical_shift N M+vertical_shift]);
terminator_dest_name = strcat(component_dest_name,'/',strcat('Terminator',num2str(i)));
terminatorblk = add_block('Simulink/Sinks/Terminator',terminator_dest_name,'position',[Horizontal+100 Vertical+vertical_shift N+100 M+vertical_shift]);
% example: add_line(component_name,'In1/1','Terminator1/1');
add_line(component_dest_name,strcat('In',num2str(i),'/1'),strcat('Terminator',num2str(i),'/1'));
end