Single Linked List Insertion Algorithm In Array Javascript Append