Why is flow control implemented in both transport and data link layer? If it is already implemented in the data link layer then what is the need to implement it again in the transport layer.
Why is flow control implemented in both transport and data link layer?
Because flow control is not implemented in all transport layer protocols.
TCP may be popular, but there are a non-trivial number of people using UDP applications, or completely non-IP applications (such as FCOE, which heavily depends on flow control in DCB / Lossless ethernet)Note 1.
Add to this cpt_fink's comment that data-link flow-control can be implemented as per-hop behavior (which basically goes back to my first point). By definition, transport flow control cannot be implemented thusly.
Note 1 I'm personally not fond of the notion of "lossless ethernet", but I can't change the reality that people use that term.
Actually, you must take into account that the TCP/IP protocol was not built to run over ethernet exclusively. There are various link-layers that might be used with TCP/IP. Some might provide a local link-only flow control (like between two serial ports using XON/XOFF) or something like that. Thats why the TCP protocol ended up providing a flow control mechanism that works at a much higher level and is generic enough to traverse multiple different types of networking links.