My current understanding is that mac addresses are used amongst local networks to send data. And public ip addresses are outside of LANs. Local ips are used within LAN's only so why are they needed if mac addresses do this aswell?
Technically, MAC addresses is something that is fairly specific to Ethernet and related technologies. This is an important detail because Ethernet is not the only physical networking protocol in existence, even though on contemporary hardware it certainly is one of the most commonly used ones.
A MAC address addresses the physical Ethernet network adapter. In Ethernet, MAC addresses have no structure that facilitates routing (their structure is based on the hardware manufacturer, not their location within the network). This, as well as the fact that they might not exist on other types of networking hardware, makes them unsuitable for use on an internetwork (a network connecting disparate networks) such as the Internet.
It was recognized early on that it is beneficial if all systems on a network, especially a large network comprised of many disparate systems (such as the Internet), speak a common protocol. This was the motivation for designing the Internet Protocol (IP) and related protocols, such as TCP, UDP and ICMP which all run on top of IP (in a stack where IP runs on top of some physical networking layer, such as Ethernet over twisted-pair, Ethernet over coaxial cable, Token Ring, WiFi, etc.).
An IP address is a logical construction. It is assigned hierichally by various organizations that control large or small portions of the IP address space, facilitating its use for routing purposes (it's easy to tell whether an IP address "belongs here" or "does not belong here", without needing full knowledge of the entire network). Not all network interfaces necessarily have IP addresses (they might be attached to hosts where no IP stack exists, or where one exists but has not yet been initialized, or any of several other possibilities), a single IP address can be used to address multiple hosts, and a single network interface can have multiple IP addresses.
At some point, it was recognized that not all hosts that speak IP need to be able to speak directly to every other host on the Internet. Some hosts that speak IP might not even need to speak to hosts on the Internet at all, and if the network is isolated from the Internet, IP addresses can be assigned however the network operator feels is most practical. However, for networks that need to be connected to other networks (which is, well, the point of the Internet), picking an address at random without coordination would not work. The thing is, it turned out that many leaf site hosts benefit from IP but don't really need to be connected directly to the Internet. Especially in situations where IP address space was scarce, this was a very useful use case to allow for. Hence, specific IP ranges were set aside for use on "private Internets". This was one of the things that made network address translation a practically usable technique for further conservation of IP address space, but NAT is not the only way of bridging such hosts onto the Internet (proxy servers being another).
A "private Internet" can easily span multiple locations, or otherwise require subnetting and routing. The home network case of a single subnet with a few hosts, connected through a single gateway to a larger network, is the trivial case. My own home network consists of two logically and electrically separate networks, each on its own subnet, with limited routing between the two. If I connect to my workplace's network over a VPN link, then some degree of traffic flow can happen in both directions, but the networks remain separate. Two large datacenters could be connected over a VPN link without using globally routable addresses for anything more than the VPN concentrators at each end of the VPN link itself.
Using private IP addresses means that at most, I need to coordinate with my employer to ensure that they don't use the same IP addresses on their network as I do on mine at home, or the administrators working on each datacenter need to coordinate with each other to ensure their IP assignments don't collide. Using private IP addresses also means that I don't need to concern myself with what physical network hardware are in use at the other end of the Internet link; I only need to concern myself with the fact that both ends speak IP, and that both ends use different IP address allocations (to avoid conflicts).
All of this is some of the reasons why private IP addresses are used in lieu of hardware addresses such as MAC addresses.
Another thing I don't understand completely is the private ip classes, A B and C. What is the difference between these?
Classful IP addressing has been deprecated since 1993, when Classless Inter-Domain Routing (CIDR) was introduced.
The "A", "B" and "C" IP address classes were subdivisions of the IP address space, where the initial few bits of the IP address determined the length of the network identifier in the address. It probably seemed like a good idea in 1981, but the way this was done turned out to be hugely wasteful in practice as the Internet grew. Keep in mind that 1993 was well before commodity Internet access became reasonably commonplace outside of the purely academic sector; in many countries, that happened around 1995-1996 or so.
These days, any networking textbook that talks about "class A", "class B", "class C" and so on IP space should be thrown out immediately. It's about as relevant to modern networking as a book describing how to maintain your Ford Model T is to a present-day racecar mechanic. In some colloquial speech, "class A", "B" and "C" are used to refer to CIDR netmask lengths of 8, 16 and 24 bits, corresponding to the initial network portion lengths of those IP addresses, without having anything to do with where in the IP address space those networks reside, but this is not what IP address classes were.
local ip address
?