Try this :
1- place a Loco and some wagons on the track ;
2- name your Loco and your wagons (e.g. Loko, Wag1, Wag2, Wag3,...) ;
3- in the init field of your first wagon (not the Loco), type :
AEFDetachWaggon = Wag1 ; [Wag1, Loko] exec "\AEF_Train\script\Attach.sqs"
That way, you will be sure your first wagon is detached from the Loco (it may have been towed to it automatically if close enough on the map, and that could cause trouble with the attach script), and then it will be script-attached to the Loco. N.B. : if you type [Loko, Wag1] instead of [Wag1, Loko], it's a mess : you'll find your wagon anywhere but where you want it to be !
4- in the init field of your second wagon, type :
AEFDetachWaggon = Wag2 ; [Wag2, Wag1] exec "\AEF_Train\script\Attach.sqs"
And so on...
Good luck !