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