What is the last macbook or macbook pro model that had a replaceable battery and hdd? I was thinking of buying a used macbook or macbook pro and plan to replace the battery and HDD
As far as I am aware you can replace the battery and HDD/SSD on most MacBook Pro models. Have a look at the manuals on iFixit. 

MacBook Pro 13" Retina Display Mid 2014:


You can replace the battery like this
And the SSD like this.


MacBook Pro 13" Unibody Mid 2012:


I think the last HDD MacBook Pro. No retina display, but you can replace the optical drive and use a 2nd HDD/SSD instead.