Having Problems with AppendLayoutObject

Hi all, I am fairly new to Igor. My task at the moment is to make a piece of code that takes multiple graphs and organize them to a layout.
The problem I am having is the AppendlayoutObject command does not seem to recognize the names of the graph. For example, if the graphs w

Proc MakeGraph()
variable num = numpnts(Hold_Names)  //string wave that holds the names of the various waves to be graphed
Do
    Graph(Hold_Names[num-1])
    num -= 1
While (num > 0)
End
   
Function Graph(name)
string name
string name1 = name + "_Phase Error"
NewLayout/N=$name/Hide=0
display/Hide=0 $(name)[][0] as name1
AppendLayoutObject/W=$name graph $name1
End


What happens when I run the above code is the graph appended to the specified layout is a blank box. The appendlayoutobject command seems to only recognize the graph by the names graph0, graph1 and so on and not by the names I have given it. Eg, Data_A_Phase Error
In your code, name1 contains the graph title, not the name.

Read this to understand the difference between a name and a title:
DisplayHelpTopic "Window Names and Titles"