How to programatically add one-to-many relationship??

How to programatically add one-to-many relationship??

I have a one to many relationship between Student and Course forms. Each student can have multiple Course.

The intention of the following code is to test how to add multiple courses to one student. But unfortunately did not work. Can anybody tell me how to do it properly?

Student.On Add.On Success:
c1 = Course [Name == "Course 1"];
c2 = Course [Name == "Course 2"];

input.Course.add(c1.ID);
input.Course.add(c2.ID);