write function to combine arrays