here a DCG possibility. It's fairly clean, I think.
list(L) --> {length(L, _)}, L.
rule(R) -->
[my, name, is], list(Name),
[and, i, live, in], list(Country),
{flatten([hello, Name, of, Country],R)}.
rule([hello|Name]) -->
[my, name, is], list(Name) .
answer(Sentence, Response) :-
phrase(rule(Response), Sentence), !.
with that
?- answer([my, name, is, bill, the, kid, and, i, live, in, new, york],R).
R = [hello, bill, the, kid, of, new, york].
the essential production here is list//1, that matches any definite length list of tokens.
Beware: list(A),list(B),
, with both A, B unbound should be avoided.
It's ok instead if there are tokens in between, like in list(A),[and],list(B),