Here David describes the winds causing the waves to become high as if the wind was an object fiercely stirring something. AT: "that caused the waves of the sea to become very high" (See: [[rc://en/ta/man/translate/figs-metaphor]])
This describes the ships rising and falling with the waves. The extremes of rising to the sky and falling to the depths are an exaggeration to express how horrible the windstorm was and how large the waves were. AT: "their ships would rise very high on the waves and then they would fall very low between the waves" (See: [[rc://en/ta/man/translate/figs-hyperbole]])
The phrase "at their wit's end" means that they did not know what to do. AT: "and they did not know what to do" or "they had no idea what to do" (See: [[rc://en/ta/man/translate/figs-idiom]])