How does erosion and deposition affect a coastline?
It really depends on what you're specifically asking. If you're asking if the erosion occurs along a coastline, it's different than how erosion, in general, allows for the deposition of sediments along a coastline. More specifically, erosion is a general term for the many processes that breakdown matter, and it can be chemical or physical (oxidation vs frost wedging, for example).
The coastline, generally speaking, is a collection of deposited sediment from all over the place. The water, then, by definition, is the transport agent (it's the most powerful erosional and transport agent on the planet).
Physical matter erodes over time, for a variety of different reasons, and is transported to different areas of the earth, by different means. In fact, the large chunks of the planet itself are constantly moving, too! Some of the tectonic plates themselves are shaved a little bit during subduction, and which can have a significant impact on the shape and composition of coastlines.
Erosion occurs at the coastline itself after the soft sand is compacted and cemented to form sedimentary rocks (sandstone is common, which is the protolith for its metamorphic cousin quartzite). The sedimentary rocks are broken down by the various erosional agents (again, water being the most common and powerful), and then transported to a different location. These processes are occurring constantly, but very slowly according to our humanistic time scales. As a result, the coastlines are constantly being shaped.