export xtd file from xyz file

Hello. 
I'm trying to make trajectory file in xtd format from the data in xyz format.
I write pearl script like below, but output file says that " number of total frames 0"
Can I ask the reason why this error is made and how to solve this problem ? 
Thanks.

Following is the script.
--------------------------------------------------------------------------------------------------
#!perl

use strict;
use Getopt::Long;
use MaterialsScript qw(:all);

# Set xtd file name and the path of 'Trajectory' directory
my \\\$xtd_name="R400.xtd";
my \\\$directory="C:/Users/Admin/Documents/Materials Studio Projects/FreeVolume_Files/Documents";
my \\\$xyz_name="movieconf.xyz";

my \\\$xtddoc = Documents->New("R400.xtd");
my \\\$xyzdoc = Documents->Import(\\\$directory."/".\\\$xyz_name);

\\\$xtddoc->Trajectory->AppendFramesFrom(\\\$xyzdoc,Frames(Start=>1, End=>10));

my \\\$trajectory = \\\$xtddoc->Trajectory;
print " number of total frames = ", \\\$trajectory->NumFrames;

for (my \\\$i=1; \\\$i<\\\$trajectory->NumFrames; \\\$i++){
    \\\$trajectory->CurrentFrame = \\\$i;
    print "Current Frame is ", \\\$trajectory->CurrentFrame;
}
\\\$xtddoc->Close;