Sorry, my file didn't upload. Here it is again.
I'm not sure that script will even work for you as it is written. I'd expect steps that modify a field in the portal's table to link it to the current record on your layout.
In order to have a portal on your layout, you also need a relationship between the Table Occurrence listed in Layout Setup | "Show Records From" (Main confo) and Portal setup | "Show Related Records From" (Insertion Dates). (Table Occurrences are what we call the "boxes" found in Manage | Database | Relationships)
In that relationship, if you enable "allow creation of records via this relationship" for Insertion Dates, you should be able to add new related records in the portal simply by entering data directly into the blank "add" row of your portal.