Writing is a complex piece of art. It has many aspects. You will be surprised to hear of the numerous folds of writing besides grammar. A literary device is something similar. It is what writers use to add special effects to their piece. For instance, a literary device can be a flashback or an analogy.
This introduces a new dimension in the writing and a special flavor to the writing. Similarly, a literary device can be a metaphor. This helps readers understand the writer’s idea better. It is a special writing aid that writers use to enhance and beautify their writing.