The word "top" is used here because David went up in elevation and is at the top of a hill. Alternate translation: "at the top of the hill" (See: [[rc://en/ta/man/jit/figs-explicit]])
This is an act showing shame or repentance. Here the word "earth" means dirt. Alternate translation: "He had torn his clothes and put dirt on his head to show that he was very sad" (See: [[rc://en/ta/man/jit/translate-symaction]] and [[rc://en/ta/man/jit/figs-synecdoche]])