Typical learner's question, I guess… let's create a typical learner's answer, not using any library functions:
let AppendManually l1 l2 =
let rec rev acc = function
| [] -> acc
| x :: xs -> rev (x :: acc) xs
rev [] (rev (rev [] l1) l2)
How does it work? Since we cannot append to the end of a list, only prepend to the beginning, we create a helper function rev
that takes two lists, and will loop through the second list from beginning to end, prepending all elements to the first list. Once the second list is empty, the first list contains all elements in reverse order.
This function is then used as follows: prepend the elements of the first list to an empty list in reverse order; prepend the elements of the second list in reverse order to the result of the first call; lastly, prepend the result of that in reverse order to an empty list again.