This might be because sometimes Simulink cannot handle spaces in directory names.
Change the path so that it does not contain any spaces and then try again.
For related information you can also refer to the following MATLAB Answer: https://in.mathworks.com/matlabcentral/answers/391183-arduino-simulink-connection-error-failed-to-generate-all-binary-outputs-error?s_tid=answers_rc1-1_p1_Topic
