Even if you correct this you are not going to get it work.
The underlying datamodel objects and attributes do not exist!
You need to create an object like this one :
"lrel" object are used to store n to n relationship.
Since a CNT can have several attachment and an attachment can be linked to different CNT, it's n to n.
You will also need to edit xx_atmnt_tab.htmpl to take into account that there is a new object that can be linked to attmnt.
And even after that, it may not work as I am not aware of all the prerequisite for SDM to start uploading attachment to a new object.
It is not an easy customization.