Apple terminal no home and end key - Use cmd left or cmd right

You can use Better Touch Tool for this (it's no longer free, 5$ minimum), just assign keyboard shortcuts to work in Terminal app only. Remap ⌘ CMD+ to ⌃ CTRL+A and ⌘ CMD+ to ⌃ CTRL+E. Here's the sample:

enter image description here

You can adjust the keybindings in Terminals preferences under Profiles -> Keyboard. This is on a Profile by profile basis. Map control+a (\001) to the goto beginning of line and control+e (\005) to go to the end of the line to any keyboard shortcut you want (just don't overwrite anything important already in use) Terminal Preference