That's a good start.
Two things you could do:
1) You could enlarge the space with malloc(len + 1), and then have the '\0' included as part of the entered string.
2) You could remove the newline that fgets() put onto the last char (before the \0) with
Code:
if(data[len-1]=='\n')
data[len-1]='\0';
And then you'd have the null termination for the string, in place. (null termination is the end of string char). Note that strcpy() will copy over the '\0', if it is present.
Then the whole central block of code needs to go into a for loop, so you can get multiple char string space malloc'd and filled with data, instead of just str1[0].
AND of course, if you malloc for 3 strings, you need to free() them, also in a loop.