You'll need to add page items to pages or spreads, not to layers.
@Bob – and later you can assign your new text frame to a layer:
myTextFrame.itemLayer = myLayer;
[...] – and later you can assign your new text frame to a layer:
In fact you can do so immediately when creating the new text frame (you still have to add to a page or spread). See the first optional parameter in http://jongware.mit.edu/idcs5js/pc_TextFrames.html#add
(The above direct link appears courtesy of Mr. John Hawkinson, Esq.)