The concat() function of pandas needs either Series or DataFrame as arguments. You are providing a list, so your code is giving the error. To fix the error, convert the list to Series.
Make the following change in your code, which should solve the issue.
factor_columns = [f'factor_{i}' for i in range(W.shape[1])]
feature_columns = [f'f_{i}' for i in range(H.shape[1])]
feature_df = pd.DataFrame(H, columns=feature_columns)
result_df = pd.concat([pd.Series(factor_columns), feature_df], axis=1)
result_df.to_csv(output_filename1, index=False)