Depending on your software version you could do this several ways. You could use a HTTP Class in versions prior to 11.4, use Local Traffic Policies in 11.4 and newer, or use an iRule as you are attempting.
I would adjust your rule to the following:
if { [HTTP::host] ends_with "abc.com"} { HTTP::redirect "http://www.xyz.com/xxx/xxxxxxx[HTTP::uri]" }
If you need a 301 redirect instead of a 302, you will have to use HTTP::respond.
You can get a better sense of what is happening by using a log statement like the following, putting it or something similar inside and outside of your if statement. Be sure to disable it before running the rule in production.
log local0. "client: [IP::client_addr], host: [HTTP::host], uri: [HTTP::uri]"