this here doc looks funny. How about something like

```
cat << EOF >> ~/.ssh/config
Host $host
User core
IdentityFile $key_file
EOF
```

Just remove the spacing